javax.resource.spi.work.WorkListener Java Examples

The following examples show how to use javax.resource.spi.work.WorkListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 5 votes vote down vote up
public Worker(final Work work, final WorkListener workListener, final long startTimeout) {
    this.work = work;
    this.workListener = workListener;
    if (startTimeout <= 0) {
        this.startTimeout = INDEFINITE;
    } else {
        this.startTimeout = startTimeout;
    }
}
 
Example #2
Source File: SimpleTaskWorkManager.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void doWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set");
	executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #3
Source File: SimpleTaskWorkManager.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public long startWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	return executeWork(this.asyncTaskExecutor, work, startTimeout, true, executionContext, workListener);
}
 
Example #4
Source File: SimpleTaskWorkManager.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void scheduleWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	executeWork(this.asyncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #5
Source File: WorkWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new WorkWrapper
 *
 * @param workManager the work manager
 * @param si The security integration
 * @param work the work
 * @param executionContext the execution context
 * @param workListener the WorkListener
 * @param startedLatch The latch for when work has started
 * @param completedLatch The latch for when work has completed
 * @param startTime The start time
 * @throws IllegalArgumentException for null work, execution context or a negative start timeout
 */
public WorkWrapper(WorkManagerImpl workManager, 
                   SecurityIntegration si,
                   Work work, 
                   ExecutionContext executionContext, 
                   WorkListener workListener,
                   CountDownLatch startedLatch,
                   CountDownLatch completedLatch,
                   long startTime)
{
   super();

   if (workManager == null)
      throw new IllegalArgumentException("Null work manager");
   if (si == null)
      throw new IllegalArgumentException("Null security integration");
   if (work == null)
      throw new IllegalArgumentException("Null work");
   if (executionContext == null)
      throw new IllegalArgumentException("Null execution context");

   this.workManager = workManager;
   this.securityIntegration = si;
   this.work = work;
   this.executionContext = executionContext;
   this.workListener = workListener;
   this.startedLatch = startedLatch;
   this.completedLatch = completedLatch;
   this.startTime = startTime;
   this.workContexts = null;
}
 
Example #6
Source File: ActiveMQRATestBase.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public long startWork(Work work,
                      long l,
                      ExecutionContext executionContext,
                      WorkListener workListener) throws WorkException {
   return 0;
}
 
Example #7
Source File: SimpleTaskWorkManager.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void scheduleWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	executeWork(this.asyncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #8
Source File: SimpleTaskWorkManager.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public long startWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	return executeWork(this.asyncTaskExecutor, work, startTimeout, true, executionContext, workListener);
}
 
Example #9
Source File: SimpleTaskWorkManager.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void doWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set");
	executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #10
Source File: SimpleWorkManager.java    From ByteJTA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public long startWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
		throws WorkException {
	SimpleWorkListener wrappedListener = new SimpleWorkListener(workListener);
	wrappedListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
	SimpleWork task = new SimpleWork();
	task.setSource(this);
	task.setWork(work);
	task.setWorkListener(wrappedListener);
	this.executor.submit(task);
	return wrappedListener.waitForStart();
}
 
Example #11
Source File: SimpleWorkManager.java    From ByteJTA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void scheduleWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
		throws WorkException {
	// SimpleWorkListener wrappedListener = new SimpleWorkListener(workListener);
	// wrappedListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
	// SimpleWork task = new SimpleWork();
	// task.setSource(this);
	// task.setWork(work);
	// task.setWorkListener(wrappedListener);
	// // ScheduledFuture<?> future =
	// this.scheduled.scheduleAtFixedRate(task, 0, 1000, TimeUnit.MILLISECONDS);
	throw new WorkException("not supported yet!");
}
 
Example #12
Source File: SimpleTaskWorkManager.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void scheduleWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	executeWork(this.asyncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #13
Source File: SimpleTaskWorkManager.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public long startWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	return executeWork(this.asyncTaskExecutor, work, startTimeout, true, executionContext, workListener);
}
 
Example #14
Source File: SimpleTaskWorkManager.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void doWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set");
	executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #15
Source File: WorkWrapper.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create a new WorkWrapper
 *
 * @param workManager the work manager
 * @param si The security integration
 * @param work the work
 * @param executionContext the execution context
 * @param workListener the WorkListener
 * @param startedLatch The latch for when work has started
 * @param completedLatch The latch for when work has completed
 * @param startTime The start time
 * @throws IllegalArgumentException for null work, execution context or a negative start timeout
 */
public WorkWrapper(WorkManagerImpl workManager, 
                   SecurityIntegration si,
                   Work work,
                   ExecutionContext executionContext,
                   WorkListener workListener,
                   CountDownLatch startedLatch,
                   CountDownLatch completedLatch,
                   long startTime)
{
   super();

   if (workManager == null)
      throw new IllegalArgumentException("Null work manager");
   if (si == null)
      throw new IllegalArgumentException("Null security integration");
   if (work == null)
      throw new IllegalArgumentException("Null work");
   if (executionContext == null)
      throw new IllegalArgumentException("Null execution context");

   this.workManager = workManager;
   this.securityIntegration = si;
   this.work = work;
   this.executionContext = executionContext;
   this.workListener = workListener;
   this.startedLatch = startedLatch;
   this.completedLatch = completedLatch;
   this.startTime = startTime;
   this.workContexts = null;
}
 
Example #16
Source File: SimpleTaskWorkManager.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void doWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set");
	executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #17
Source File: SimpleTaskWorkManager.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void scheduleWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	executeWork(this.asyncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
 
Example #18
Source File: SimpleTaskWorkManager.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public long startWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener)
		throws WorkException {

	Assert.state(this.asyncTaskExecutor != null, "No 'asyncTaskExecutor' set");
	return executeWork(this.asyncTaskExecutor, work, startTimeout, true, executionContext, workListener);
}
 
Example #19
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void doWork(final Work work, final long startTimeout, final ExecutionContext executionContext, final WorkListener workListener) throws WorkException {
    if (work == null) {
        throw new NullPointerException("work is null");
    }
    executeWork(WorkType.DO, work, startTimeout, executionContext, workListener);
}
 
Example #20
Source File: WorkManagerTaskExecutor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void doWork(Work work, long delay, ExecutionContext executionContext, WorkListener workListener)
		throws WorkException {

	this.workManager.doWork(work, delay, executionContext, workListener);
}
 
Example #21
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void scheduleWork(final Work work, final long startTimeout, final ExecutionContext executionContext, final WorkListener workListener) throws WorkException {
    if (work == null) {
        throw new NullPointerException("work is null");
    }
    executeWork(WorkType.SCHEDULE, work, startTimeout, executionContext, workListener);
}
 
Example #22
Source File: SimpleWorkManager.java    From tomee with Apache License 2.0 4 votes vote down vote up
public long startWork(final Work work, final long startTimeout, final ExecutionContext executionContext, final WorkListener workListener) throws WorkException {
    if (work == null) {
        throw new NullPointerException("work is null");
    }
    return executeWork(WorkType.START, work, startTimeout, executionContext, workListener);
}
 
Example #23
Source File: SimpleTaskWorkManager.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public DelegatingWorkAdapter(Work work, WorkListener workListener, boolean acceptOnExecution) {
	this.work = work;
	this.workListener = workListener;
	this.acceptOnExecution = acceptOnExecution;
}
 
Example #24
Source File: ActiveMQRATestBase.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void doWork(Work work,
                   long l,
                   ExecutionContext executionContext,
                   WorkListener workListener) throws WorkException {
}
 
Example #25
Source File: ActiveMQRATestBase.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void scheduleWork(Work work,
                         long l,
                         ExecutionContext executionContext,
                         WorkListener workListener) throws WorkException {
}
 
Example #26
Source File: WorkConnectionImpl.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public long startWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
   throws WorkException
{
   return mc.startWork(work, startTimeout, execContext, workListener);
}
 
Example #27
Source File: WorkConnectionImpl.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void scheduleWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
   throws WorkException
{
   mc.scheduleWork(work, startTimeout, execContext, workListener);
}
 
Example #28
Source File: SimpleWork.java    From ByteJTA with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void setWorkListener(WorkListener workListener) {
	this.workListener = workListener;
}
 
Example #29
Source File: SimpleWorkListener.java    From ByteJTA with GNU Lesser General Public License v3.0 4 votes vote down vote up
public SimpleWorkListener(WorkListener workListener) {
	this.delegate = workListener;
}
 
Example #30
Source File: WorkConnectionImpl.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void doWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener)
   throws WorkException
{
   mc.doWork(work, startTimeout, execContext, workListener);
}