理解这一句话: 一个begin tran会增加一个事务计数器,要有相同数量的commit与之对应,而rollback可以回滚全部计数器 这个错误一般是出现在嵌套事务中. 测试环境 sql 2008 例如: begin transaction t1 --这里是逻辑处理 begin transaction t2 --建立一个事务点 save transaction point2 --这里是逻辑处理 --这里报错了,需要回滚事务 if @@error<>0 begin goto roll2 end
计数 直接上代码 public class LocalStormSumTopology { public static void main(String[] agrs) { //Topology是通过build模式创建出来的 //storm中的所有作业都是通过topology来指定的 TopologyBuilder builder = new TopologyBuilder(); //在设置bolt到topology时,需要设置该bolt的上游的spout或者bolt的id,这样topology
/** * 单词计数 */ public class LocalTridentCount { public static class MyBatchSpout implements IBatchSpout { Fields fields; HashMap<Long, List<List<Object>>> batches = new HashMap<Long, List<List<Object>>>(); public MyBatch
倒计数锁存器(CountDown Latch)是异常性障碍,允许一个或多个线程等待一个或者多个其他线程来做某些事情. public static long time(Executor executor,int concurrency,final Runnable action)throws InterruptedException{ //CountDownLatch 构造器参数代表 只有调用countDown()方法达到这个int值的时候,才能继续(所以多线程的情况下可以在此阻塞) final