/** {@inheritDoc} */ @Override public <T> T affinityKey() { try { return (T) job.getDeployment().annotatedValue(job.getJob(), GridCacheAffinityMapped.class); } catch (GridException e) { throw F.wrap(e); } }
/** {@inheritDoc} */ @Override public String cacheName() { try { return (String) job.getDeployment().annotatedValue(job.getJob(), GridCacheName.class); } catch (GridException e) { throw F.wrap(e); } }
/** {@inheritDoc} */ @Override public boolean heldcc() { if (ctx == null) return false; if (job == null) job = ctx.job().activeJob(jobId); return job != null && job.held(); }
/** {@inheritDoc} */ @Override public void callcc() { if (ctx != null) { if (job == null) job = ctx.job().activeJob(jobId); if (job != null) // Execute in the same thread. job.execute(); } }
/** {@inheritDoc} */ @Override public <T> T holdcc(long timeout) { if (ctx != null) { if (job == null) job = ctx.job().activeJob(jobId); // Completed? if (job != null) { if (timeout > 0 && !job.isDone()) { final long endTime = System.currentTimeMillis() + timeout; // Overflow. if (endTime > 0) { ctx.timeout() .addTimeoutObject( new GridTimeoutObject() { private final GridUuid id = GridUuid.randomUuid(); @Override public GridUuid timeoutId() { return id; } @Override public long endTime() { return endTime; } @Override public void onTimeout() { callcc(); } }); } } job.hold(); } } return null; }