예제 #1
0
 protected TimeScheduler getTimer() {
   if (prot_stack != null) {
     TP transport = prot_stack.getTransport();
     if (transport != null) return transport.getTimer();
   }
   return null;
 }
예제 #2
0
파일: GMS.java 프로젝트: jtoerber/JGroups
 public void init() throws Exception {
   if (view_ack_collection_timeout <= 0)
     throw new IllegalArgumentException("view_ack_collection_timeout has to be greater than 0");
   if (merge_timeout <= 0)
     throw new IllegalArgumentException("merge_timeout has to be greater than 0");
   prev_members = new BoundedList<Address>(num_prev_mbrs);
   prev_views = new BoundedList<Tuple<View, Long>>(num_prev_views);
   TP transport = getTransport();
   timer = transport.getTimer();
   if (timer == null) throw new Exception("timer is null");
   if (impl != null) impl.init();
   transport.registerProbeHandler(this);
 }
예제 #3
0
 private void init(TP transport) {
   TransportConfiguration transportConfig = this.configuration.getTransport();
   SocketBinding binding = transportConfig.getSocketBinding();
   if (binding != null) {
     SocketFactory factory = transport.getSocketFactory();
     if (!(factory instanceof ManagedSocketFactory)) {
       transport.setSocketFactory(new ManagedSocketFactory(factory, binding.getSocketBindings()));
     }
   }
   ThreadFactory threadFactory = transportConfig.getThreadFactory();
   if (threadFactory != null) {
     if (!(transport.getThreadFactory() instanceof ThreadFactoryAdapter)) {
       transport.setThreadFactory(new ThreadFactoryAdapter(threadFactory));
     }
   }
   ExecutorService defaultExecutor = transportConfig.getDefaultExecutor();
   if (defaultExecutor != null) {
     if (!(transport.getDefaultThreadPool() instanceof ManagedExecutorService)) {
       transport.setDefaultThreadPool(new ManagedExecutorService(defaultExecutor));
     }
   }
   ExecutorService oobExecutor = transportConfig.getOOBExecutor();
   if (oobExecutor != null) {
     if (!(transport.getOOBThreadPool() instanceof ManagedExecutorService)) {
       transport.setOOBThreadPool(new ManagedExecutorService(oobExecutor));
     }
   }
   ScheduledExecutorService timerExecutor = transportConfig.getTimerExecutor();
   if (timerExecutor != null) {
     if (!(transport.getTimer() instanceof TimerSchedulerAdapter)) {
       this.setValue(
           transport,
           "timer",
           new TimerSchedulerAdapter(new ManagedScheduledExecutorService(timerExecutor)));
     }
   }
 }