• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WorkEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
@Override
public void run() {
	if (this.acceptOnExecution) {
		this.workListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
	}
	synchronized (this.monitor) {
		this.started = true;
		this.monitor.notify();
	}
	this.workListener.workStarted(new WorkEvent(this, WorkEvent.WORK_STARTED, this.work, null));
	try {
		this.work.run();
	}
	catch (RuntimeException ex) {
		this.workListener.workCompleted(
				new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, new WorkCompletedException(ex)));
		throw ex;
	}
	catch (Error err) {
		this.workListener.workCompleted(
				new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, new WorkCompletedException(err)));
		throw err;
	}
	this.workListener.workCompleted(new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, null));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:SimpleTaskWorkManager.java


示例2: execute

import javax.resource.spi.work.WorkEvent; //导入依赖的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: run

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void run() {
	if (this.acceptOnExecution) {
		this.workListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
	}
	synchronized (this.monitor) {
		this.started = true;
		this.monitor.notify();
	}
	this.workListener.workStarted(new WorkEvent(this, WorkEvent.WORK_STARTED, this.work, null));
	try {
		this.work.run();
	}
	catch (RuntimeException ex) {
		this.workListener.workCompleted(
				new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, new WorkCompletedException(ex)));
		throw ex;
	}
	catch (Error err) {
		this.workListener.workCompleted(
				new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, new WorkCompletedException(err)));
		throw err;
	}
	this.workListener.workCompleted(new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, null));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:25,代码来源:SimpleTaskWorkManager.java


示例4: workAccepted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * accept work 
 *
 * @param e workEvent
 */
@Override
public void workAccepted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_ACCEPTED)
      fail("Wrong accepted type");
   source = e.getSource();
   work = e.getWork();
   startDuration = e.getStartDuration();
   exception = e.getException();

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setAcceptCount(callbackCount.getAcceptCount() + 1);
      }
   }

   super.workAccepted(e);
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:26,代码来源:StatusWorkAdapter.java


示例5: workStarted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workStarted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_STARTED)
      fail("Wrong started type");

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setStartCount(callbackCount.getStartCount() + 1);
      }
   }

   super.workStarted(e);
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:StatusWorkAdapter.java


示例6: workRejected

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workRejected(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_REJECTED)
      fail("Wrong rejected type");

   source = e.getSource();
   work = e.getWork();
   startDuration = e.getStartDuration();
   exception = e.getException();

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setRejectedCount(callbackCount.getRejectedCount() + 1);
      }
   }

   super.workRejected(e);
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:27,代码来源:StatusWorkAdapter.java


示例7: workCompleted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * complete work 
 *
 * @param e workEvent
 */
@Override
public void workCompleted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_COMPLETED)
      fail("Wrong completed type");

   if (callbackCount != null)
   {
      synchronized (this)
      {
         callbackCount.setCompletedCount(callbackCount.getCompletedCount() + 1);
      }
   }

   super.workCompleted(e);
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:StatusWorkAdapter.java


示例8: workStarted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workStarted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_STARTED)
      fail("Wrong started type");
   timeStarted = System.currentTimeMillis();
   super.workStarted(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      start.append(nw.getName());
   }

}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:21,代码来源:ContextWorkAdapter.java


示例9: workRejected

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * start work 
 *
 * @param e workEvent
 */
@Override
public void workRejected(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_REJECTED)
      fail("Wrong rejected type");
   timeRejected = System.currentTimeMillis();
   super.workRejected(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      reject.append(nw.getName());
   }

}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:21,代码来源:ContextWorkAdapter.java


示例10: workCompleted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * complete work 
 *
 * @param e workEvent
 */
@Override
public void workCompleted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_COMPLETED)
      fail("Wrong completed type");
   timeCompleted = System.currentTimeMillis();
   super.workCompleted(e);
   Work work = e.getWork();
   if (work instanceof NestProviderWork)
   {
      NestProviderWork nw = (NestProviderWork) work;
      done.append(nw.getName());
      exception = e.getException();
   }

}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:22,代码来源:ContextWorkAdapter.java


示例11: workAccepted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
@Override
public void workAccepted(WorkEvent arg0) {
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:4,代码来源:AbstractWorkItem.java


示例12: startWork

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
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();
}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:12,代码来源:SimpleWorkManager.java


示例13: workRejected

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workRejected(WorkEvent event) {
	if (this.delegate != null) {
		delegate.workRejected(event);
	}
}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:6,代码来源:SimpleWorkListener.java


示例14: workStarted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workStarted(WorkEvent event) {
	if (this.delegate != null) {
		delegate.workStarted(event);
	}
	this.startedTime = System.currentTimeMillis();
	this.signalStarted();
}
 
开发者ID:liuyangming,项目名称:ByteJTA,代码行数:8,代码来源:SimpleWorkListener.java


示例15: workAccepted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
/**
 * accept work 
 *
 * @param e workEvent
 */
@Override
public void workAccepted(WorkEvent e)
{
   if (e.getType() != WorkEvent.WORK_ACCEPTED)
      fail("Wrong accepted type");
   timeAccepted = System.currentTimeMillis();
   super.workAccepted(e);
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:14,代码来源:ContextWorkAdapter.java


示例16: workRejected

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workRejected(final WorkEvent event) {
    // Don't log doWork or startWork since exception is propagated to caller
    if (workType == WorkType.DO || workType == WorkType.START) {
        return;
    }
    final WorkException exception = event.getException();
    if (exception != null) {
        if (WorkException.START_TIMED_OUT.equals(exception.getErrorCode())) {
            logger.error(exception.getMessage());
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:13,代码来源:SimpleWorkManager.java


示例17: workCompleted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workCompleted(final WorkEvent event) {
    // Don't log doWork since exception is propagated to caller
    if (workType == WorkType.DO) {
        return;
    }

    Throwable cause = event.getException();
    if (cause != null && cause.getCause() != null) {
        cause = cause.getCause();
    }
    if (cause != null) {
        logger.error(event.getWork().toString(), cause);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:15,代码来源:SimpleWorkManager.java


示例18: workRejected

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
@Override
public void workRejected(WorkEvent event) {
	LOGGER.warn("Work {} rejected with code {}. Will retry.", new Object[] {
			event.getWork().getClass().getName(), event.getType() });
	try {
		resourceAdapter.getBootstrapCtx().getWorkManager()
				.scheduleWork(event.getWork(), SCHEDULE_WORK_START_TIMEOUT, null, this);
	} catch (WorkException e) {
		LOGGER.error(
				"exception during scheduleWork of work " + event.getWork().getClass().getName() + ": "
						+ e.getMessage(), e);
	}
}
 
开发者ID:agito-it,项目名称:activiti-jobexecutor-ee,代码行数:14,代码来源:JobAcquisitionWork.java


示例19: workAccepted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workAccepted(WorkEvent workEvent) {
}
 
开发者ID:yangting,项目名称:openjtcc,代码行数:3,代码来源:TransactionRecoveryWork.java


示例20: workCompleted

import javax.resource.spi.work.WorkEvent; //导入依赖的package包/类
public void workCompleted(WorkEvent workEvent) {
	this.completed = true;
}
 
开发者ID:yangting,项目名称:openjtcc,代码行数:4,代码来源:TransactionRecoveryWork.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AvailablePortFinder类代码示例发布时间:2022-05-22
下一篇:
Java InputComponent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap