摘要:
import java.util.concurrent.*;import java.util.*;public class TestGreenhouseScheduler {private volatile boolean light = false;private volatile boolean... 阅读全文
摘要:
import akka.actor.{ ActorRef, ActorSystem, Props, Actor, Inbox }import scala.concurrent.duration._case object Greetcase class WhoToGreet(who: String)c... 阅读全文
摘要:
package testFoldimport java.io.Fileimport scala.concurrent._import scala.concurrent.duration._import scala.concurrent.ExecutionContext.Implicits.globa... 阅读全文
摘要:
import scala.concurrent._import scala.concurrent.duration._import scala.concurrent.ExecutionContext.Implicits.globalimport java.net.URLimport java.net... 阅读全文
摘要:
锁设计目的:1 当db可以正常连接时,控制当前最大连接线程数量为6,最大的等待线程数为15,接下来线程如何的试图获取锁请求自己报异常。2 设置锁等待时间,当等待线程超过该时间,自动释放锁。3 当线程连接时间过长,超过5分钟,可视为db已经发生异常,将db 状态quitemode设为false,后续线... 阅读全文
摘要:
常用并发辅助类 CountDownLatch Semaphore CyclicBarrier, 都基于ReentrantLock实现。1 Semaphores are often used to restrict the number of threads than can* access s... 阅读全文
摘要:
Callable Runable和Future FutureTask的使用1 先看看接口定义public interface Runnable {public abstract void run();//定义为void,和thread一样,无法返回执行结果}public interface Call... 阅读全文
摘要:
ReentrantLock和synchronized的选择1 synchronized的弊端,简化了代码工作,并且与异常处理操作实现了很好的交互,但是表现不够灵活,对线程控制较小,比如无法中断等待的线程,或者无法在请求获取锁时无限的等待,也没法实现非阻塞结构的加锁规则。2 reentrantlock... 阅读全文
摘要:
create table user(userid STRING,sex STRING,age INT,career INT,code STRING)ROW FORMAT DELIMITEDFIELDS TERMINATED BY ':';LOAD DATA LOCAL INPATH '/home/h... 阅读全文
摘要:
http://www.kekenet.com/Article/201310/258859.shtmlAlibaba Makes Internet MagicTopics:EntrepreneurshipLeadershipMedia and TechnologyWorld BusinessPrint... 阅读全文