当前位置: 首页>>代码示例>>Java>>正文


Java WorkException类代码示例

本文整理汇总了Java中javax.resource.spi.work.WorkException的典型用法代码示例。如果您正苦于以下问题:Java WorkException类的具体用法?Java WorkException怎么用?Java WorkException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WorkException类属于javax.resource.spi.work包,在下文中一共展示了WorkException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startWork

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
@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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SimpleTaskWorkManager.java

示例2: execute

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
void execute(final Work arg0, final WorkListener arg3, boolean join) throws WorkException {
	if (arg3 != null) {
		arg3.workAccepted(Mockito.mock(WorkEvent.class));
		arg3.workStarted(Mockito.mock(WorkEvent.class));
	}
	
	t = new Thread(new Runnable() {
		
		@Override
		public void run() {
			arg0.run();
			if (arg3 != null) {
				arg3.workCompleted(Mockito.mock(WorkEvent.class));
			}							
		}
	});
	t.start();
	if (join) {
		try {
			t.join();
		} catch (InterruptedException e) {
			throw new WorkException(e);
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:FakeWorkManager.java

示例3: start

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
public void start() {
	resourceAdapterCustomImpl = new ResourceAdapterCustomImpl(this);

	try {
		eisConnection = new EisConnectionWorker();
		workManager.startWork(eisConnection);

		try {
			boolean bf = eisConnection.waitForStartupReady(10000);
			log.debug("eisConnection={} bf={} isStartupReadyFlag={} isShutdownFlag={}", eisConnection, bf, eisConnection.isStartupReadyFlag(), eisConnection.isShutdownFlag());
		} catch (InterruptedException e) {
			log.warn("", e);
		}
	} catch (WorkException ex) {
		log.debug("", ex);
	}
}
 
开发者ID:dlmiles,项目名称:full-example-ee7-jca-eis,代码行数:18,代码来源:ResourceAdapterImpl.java

示例4: invoke

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
private void invoke(final MessageEndpoint endpoint, final Method m, final Path path) throws WorkException {
	resourceAdapter.getBootstrapContext().getWorkManager().scheduleWork(new Work() {
		
		@Override
		public void run() {
			try {
				Method endpointMethod = endpoint.getClass().getMethod(m.getName(), m.getParameterTypes()); 
				endpoint.beforeDelivery(endpointMethod);
				
				endpointMethod.invoke(endpoint, path.toFile());
				
				endpoint.afterDelivery();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		
		@Override
		public void release() {}
	});
}
 
开发者ID:robertpanzer,项目名称:filesystemwatch-connector,代码行数:22,代码来源:FSWatchingThread.java

示例5: testCannotDeclaredSynchronizedRunMethodWork

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * Test for paragraph 5
 * Both the run and release methods in the Work implementation may contain synchronization 
 *            synchronization but they must not be declared as synchronized methods.
 * @throws Throwable throwable exception 
 */
@Test(expected = WorkException.class)
public void testCannotDeclaredSynchronizedRunMethodWork() throws Throwable
{
   SynchronizedRunWork sw = new SynchronizedRunWork();
   WorkConnection wc = wcf.getConnection();
   try
   {
      wc.doWork(sw);
      fail("Synchronized method not catched");
   }
   finally
   {
      wc.close();
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:WorkInterfaceTestCase.java

示例6: testCannotDeclaredSynchronizedReleaseMethodWork

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * Test for paragraph 5
 * Both the run and release methods in the Work implementation may contain synchronization 
 *            synchronization but they must not be declared as synchronized methods.
 * @throws Throwable throwable exception 
 */
@Test(expected = WorkException.class)
public void testCannotDeclaredSynchronizedReleaseMethodWork() throws Throwable
{
   SynchronizedReleaseWork sw = new SynchronizedReleaseWork();
   WorkConnection wc = wcf.getConnection();
   try
   {
      wc.doWork(sw);
      fail("Synchronized method not catched");
   }
   finally
   {
      wc.close();
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:WorkInterfaceTestCase.java

示例7: doWork

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void doWork(Work work) throws WorkException
{
   if (policy == null || selector == null || transport == null ||
       work == null || !(work instanceof DistributableWork) || !doWorkDistributionEnabled)
   {
      localDoWork(work);
   }
   else
   {
      doFirstChecks(work, WorkManager.INDEFINITE, null);
      checkTransport();

      DistributableWork dw = (DistributableWork)work;
      boolean executed = false;

      if (policy.shouldDistribute(this, dw))
      {
         Address dwmAddress = selector.selectDistributedWorkManager(getLocalAddress(), dw);
         if (dwmAddress != null && !getLocalAddress().equals(dwmAddress))
         {
            transport.doWork(dwmAddress, dw);
            executed = true;
         }
      }

      if (!executed)
      {
         localDoWork(work);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:36,代码来源:DistributedWorkManagerImpl.java

示例8: checkTransport

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * Check the transport
 * @exception WorkException In case of an error
 */
private void checkTransport() throws WorkException
{
   if (!transport.isInitialized())
   {
      try
      {
         transport.initialize();
         initialize();
      }
      catch (Throwable t)
      {
         WorkException we = new WorkException("Exception during transport initialization");
         we.initCause(t);
         throw we;
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:DistributedWorkManagerImpl.java

示例9: deltaDoWorkAccepted

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaDoWorkAccepted()
{
   if (trace)
      log.trace("deltaDoWorkAccepted");

   super.deltaDoWorkAccepted();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaDoWorkAccepted();
      }
      catch (WorkException we)
      {
         log.debugf("deltaDoWorkAccepted: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例10: deltaDoWorkRejected

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaDoWorkRejected()
{
   if (trace)
      log.trace("deltaDoWorkRejected");

   super.deltaDoWorkRejected();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaDoWorkRejected();
      }
      catch (WorkException we)
      {
         log.debugf("deltaDoWorkRejected: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例11: deltaStartWorkAccepted

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaStartWorkAccepted()
{
   if (trace)
      log.trace("deltaStartWorkAccepted");

   super.deltaStartWorkAccepted();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaStartWorkAccepted();
      }
      catch (WorkException we)
      {
         log.debugf("deltaStartWorkAccepted: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例12: deltaStartWorkRejected

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaStartWorkRejected()
{
   if (trace)
      log.trace("deltaStartWorkRejected");

   super.deltaStartWorkRejected();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaStartWorkRejected();
      }
      catch (WorkException we)
      {
         log.debugf("deltaStartWorkRejected: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例13: deltaScheduleWorkAccepted

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaScheduleWorkAccepted()
{
   if (trace)
      log.trace("deltaScheduleWorkAccepted");

   super.deltaScheduleWorkAccepted();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaScheduleWorkAccepted();
      }
      catch (WorkException we)
      {
         log.debugf("deltaScheduleWorkAccepted: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例14: deltaScheduleWorkRejected

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaScheduleWorkRejected()
{
   if (trace)
      log.trace("deltaScheduleWorkRejected");

   super.deltaScheduleWorkRejected();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaScheduleWorkRejected();
      }
      catch (WorkException we)
      {
         log.debugf("deltaScheduleWorkRejected: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java

示例15: deltaWorkSuccessful

import javax.resource.spi.work.WorkException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void deltaWorkSuccessful()
{
   if (trace)
      log.trace("deltaWorkSuccessful");

   super.deltaWorkSuccessful();

   if (distributedStatisticsEnabled && distributedStatistics != null && transport != null)
   {
      try
      {
         checkTransport();
         distributedStatistics.sendDeltaWorkSuccessful();
      }
      catch (WorkException we)
      {
         log.debugf("deltaWorkSuccessful: %s", we.getMessage(), we);
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:DistributedWorkManagerImpl.java


注:本文中的javax.resource.spi.work.WorkException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。