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

Java TaskEngine类代码示例

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

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



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

示例1: process

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private void process(final Message msg) {
	if(mDebug)Log.info("GCM Plugin process() called");
	try {
		if (checkTarget(msg)) {
			if(mDebug)Log.info("GCM Plugin Check=true");
			TimerTask messageTask = new TimerTask() {
				@Override
				public void run() {
						sendExternalMsg(msg);
				}
			};
			TaskEngine.getInstance().schedule(messageTask, 20);
		} else {
			if(mDebug)Log.info("GCM Plugin Check=false");
		}
	} catch (UserNotFoundException e) {
		Log.error("GCM Plugin (UserNotFoundException) Something went reeeaaaaally wrong");
		e.printStackTrace();
		// Something went reeeaaaaally wrong if you end up here!!
	}
}
 
开发者ID:meisterfuu,项目名称:Openfire-GCM,代码行数:22,代码来源:GcmPlugin.java


示例2: setKickIdleUsersTimeout

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@Override
public void setKickIdleUsersTimeout(int timeout) {
    if (this.user_timeout == timeout) {
        return;
    }
    // Cancel the existing task because the timeout has changed
    if (userTimeoutTask != null) {
        userTimeoutTask.cancel();
    }
    this.user_timeout = timeout;
    // Create a new task and schedule it with the new timeout
    userTimeoutTask = new UserTimeoutTask();
    TaskEngine.getInstance().schedule(userTimeoutTask, user_timeout, user_timeout);
    // Set the new property value
    MUCPersistenceManager.setProperty(chatServiceName, "tasks.user.timeout", Integer.toString(timeout));
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:MultiUserChatServiceImpl.java


示例3: setLogConversationsTimeout

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@Override
public void setLogConversationsTimeout(int timeout) {
    if (this.log_timeout == timeout) {
        return;
    }
    // Cancel the existing task because the timeout has changed
    if (logConversationTask != null) {
        logConversationTask.cancel();
    }
    this.log_timeout = timeout;
    // Create a new task and schedule it with the new timeout
    logConversationTask = new LogConversationTask();
    TaskEngine.getInstance().schedule(logConversationTask, log_timeout, log_timeout);
    // Set the new property value
    MUCPersistenceManager.setProperty(chatServiceName, "tasks.log.timeout", Integer.toString(timeout));
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:MultiUserChatServiceImpl.java


示例4: savePublishedItem

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
 * Creates and stores the published item in the database. 
 * @param wrapper The published item, wrapped for retry
 */
private static void savePublishedItem(RetryWrapper wrapper) {
    boolean firstPass = (wrapper.getRetryCount() == 0);
    PublishedItem item = wrapper.get();
    String itemKey = item.getItemKey();
    itemCache.put(itemKey, item);
    log.debug("Added new (inbound) item to cache");
    synchronized (itemsPending) {
        LinkedListNode<RetryWrapper> itemToReplace = itemsPending.remove(itemKey);
        if (itemToReplace != null) {
            itemToReplace.remove(); // remove duplicate from itemsToAdd linked list
        }
        LinkedListNode<RetryWrapper> listNode = firstPass ? 
                            itemsToAdd.addLast(wrapper) : 
                            itemsToAdd.addFirst(wrapper);
        itemsPending.put(itemKey, listNode);
    }
    // skip the flush step if this is a retry attempt
    if (firstPass && itemsPending.size() > MAX_ITEMS_FLUSH) {
        TaskEngine.getInstance().submit(new Runnable() {
            @Override
            public void run() { flushPendingItems(false); }
        });
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:29,代码来源:PubSubPersistenceManager.java


示例5: run

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@Override
public void run() {
    if (!isWebSocketOpen()) {
        TaskEngine.getInstance().cancelScheduledTask(pingTask);
    } else {
        long idleTime = System.currentTimeMillis() - JiveConstants.MINUTE;
        if (xmppSession.getLastActiveDate().getTime() >= idleTime) {
            return;
        }
        try {
            // see https://tools.ietf.org/html/rfc6455#section-5.5.2
            wsSession.getRemote().sendPing(null);
            lastPingFailed = false;
        } catch (IOException ioe) {
            Log.error("Failed to ping remote peer: " + wsSession, ioe);
            if (lastPingFailed) {
                closeSession();
                TaskEngine.getInstance().cancelScheduledTask(pingTask);
            } else {
                lastPingFailed = true;
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:XmppWebSocket.java


示例6: start

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
 * Starts the services used by the HttpSessionManager.
 *
 * (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable
 * (through property "xmpp.httpbind.worker.threads") amount of threads; also uses an unbounded task queue and
 * configurable ("xmpp.httpbind.worker.timeout") keep-alive.
 *
 * Note: Apart from the processing threads configured in this class, the server also uses a threadpool to perform
 * the network IO (as configured in ({@link HttpBindManager}). BOSH installations expecting heavy loads may want to
 * allocate additional threads to this worker pool to ensure timely delivery of inbound packets
 */
public void start() {
    Log.info( "Starting instance" );

    this.sessionManager = SessionManager.getInstance();

    final int maxClientPoolSize = JiveGlobals.getIntProperty( "xmpp.client.processing.threads", 8 );
    final int maxPoolSize = JiveGlobals.getIntProperty("xmpp.httpbind.worker.threads", maxClientPoolSize );
    final int keepAlive = JiveGlobals.getIntProperty( "xmpp.httpbind.worker.timeout", 60 );

    sendPacketPool = new ThreadPoolExecutor(getCorePoolSize(maxPoolSize), maxPoolSize, keepAlive, TimeUnit.SECONDS,
            new LinkedBlockingQueue<Runnable>(), // unbounded task queue
            new NamedThreadFactory( "httpbind-worker-", true, null, Thread.currentThread().getThreadGroup(), null )
    );

    sendPacketPool.prestartCoreThread();

    // Periodically check for Sessions that need a cleanup.
    inactivityTask = new HttpSessionReaper();
    TaskEngine.getInstance().schedule( inactivityTask, 30 * JiveConstants.SECOND, 30 * JiveConstants.SECOND );
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:HttpSessionManager.java


示例7: failDelivery

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private void failDelivery(final Collection<Packet> packets) {
    if (packets == null) {
        // Do nothing if someone asked to deliver nothing :)
        return;
    }
    // use a separate thread to schedule backup delivery
    TaskEngine.getInstance().submit(new Runnable() {
        @Override
        public void run() {
            for (Packet packet : packets) {
                try {
                    backupDeliverer.deliver(packet);
                }
                catch (UnauthorizedException e) {
                    Log.error("Unable to deliver message to backup deliverer", e);
                }
            }
        }
    });
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:HttpSession.java


示例8: ConnectionMultiplexerManager

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private ConnectionMultiplexerManager() {
    sessionManager = XMPPServer.getInstance().getSessionManager();
    // Start thread that will send heartbeats to Connection Managers every 30 seconds
    // to keep connections open.
    TimerTask heartbeatTask = new TimerTask() {
        @Override
        public void run() {
            try {
                for (ConnectionMultiplexerSession session : sessionManager.getConnectionMultiplexerSessions()) {
                    session.deliverRawText(" ");
                }
            }
            catch(Exception e) {
                Log.error(e.getMessage(), e);
            }
        }
    };
    TaskEngine.getInstance().schedule(heartbeatTask, 30*JiveConstants.SECOND, 30*JiveConstants.SECOND);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:ConnectionMultiplexerManager.java


示例9: LoginLimitManager

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
 * Constructs a new login limit manager.
 */
private LoginLimitManager() {
    // Set up initial maps
    attemptsPerIP = new ConcurrentHashMap<>();
    attemptsPerUsername = new ConcurrentHashMap<>();

    // Max number of attempts per ip address that can be performed in given time frame (10 attempts default)
    maxAttemptsPerIP = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerIP", 10);
    // Time frame before attempts per ip addresses are reset (15 minutes default)
    millisecondsBetweenPerIP = JiveGlobals.getLongProperty("adminConsole.perIPAttemptResetInterval", 900000);
    // Max number of attempts per username that can be performed in a given time frame (10 attempts default)
    maxAttemptsPerUsername = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerUsername", 10);
    // Time frame before attempts per ip addresses are reset (15 minutes default)
    millisecondsBetweenPerUsername = JiveGlobals.getLongProperty("adminConsole.perUsernameAttemptResetInterval", 900000);
    // Set up per username attempt reset task
    TaskEngine.getInstance().scheduleAtFixedRate(new PerUsernameTask(), 0, millisecondsBetweenPerUsername);
    // Set up per IP attempt reset task
    TaskEngine.getInstance().scheduleAtFixedRate(new PerIPAddressTask(), 0, millisecondsBetweenPerIP);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:LoginLimitManager.java


示例10: sessionCreated

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
public void sessionCreated(Session session) {         
   if (isEnabled()) {
      final Message message = new Message();
      message.setTo(session.getAddress());
      message.setFrom(serverAddress);
      message.setSubject(getSubject());
      message.setBody(getMessage());

      TimerTask messageTask = new TimerTask() {
         @Override
      public void run() {
            router.route(message);
         }
      };

      TaskEngine.getInstance().schedule(messageTask, 5000);
   }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:MotDPlugin.java


示例11: ConnectionMultiplexerManager

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private ConnectionMultiplexerManager() {
     sessionManager = XMPPServer.getInstance().getSessionManager();
     // Start thread that will send heartbeats to Connection Managers every 30 seconds
     // to keep connections open.
     TimerTask heartbeatTask = new TimerTask() {
         @Override
public void run() {
             try {
                 for (ConnectionMultiplexerSession session : sessionManager.getConnectionMultiplexerSessions()) {
                     session.deliverRawText(" ");
                 }
             }
             catch(Exception e) {
                 Log.error(e.getMessage(), e);
             }
         }
     };
     TaskEngine.getInstance().schedule(heartbeatTask, 30*JiveConstants.SECOND, 30*JiveConstants.SECOND);
 }
 
开发者ID:coodeer,项目名称:g3server,代码行数:20,代码来源:ConnectionMultiplexerManager.java


示例12: LoginLimitManager

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
 * Constructs a new login limit manager.
 */
private LoginLimitManager() {
    // Set up initial maps
    attemptsPerIP = new ConcurrentHashMap<String,Long>();
    attemptsPerUsername = new ConcurrentHashMap<String,Long>();

    // Max number of attempts per ip address that can be performed in given time frame (10 attempts default)
    maxAttemptsPerIP = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerIP", 10);
    // Time frame before attempts per ip addresses are reset (15 minutes default)
    millisecondsBetweenPerIP = JiveGlobals.getLongProperty("adminConsole.perIPAttemptResetInterval", 900000);
    // Max number of attempts per username that can be performed in a given time frame (10 attempts default)
    maxAttemptsPerUsername = JiveGlobals.getLongProperty("adminConsole.maxAttemptsPerUsername", 10);
    // Time frame before attempts per ip addresses are reset (15 minutes default)
    millisecondsBetweenPerUsername = JiveGlobals.getLongProperty("adminConsole.perUsernameAttemptResetInterval", 900000);
    // Set up per username attempt reset task
    TaskEngine.getInstance().scheduleAtFixedRate(new PerUsernameTask(), 0, millisecondsBetweenPerUsername);
    // Set up per IP attempt reset task
    TaskEngine.getInstance().scheduleAtFixedRate(new PerIPAddressTask(), 0, millisecondsBetweenPerIP);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:22,代码来源:LoginLimitManager.java


示例13: sessionCreated

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
public void sessionCreated(Session session) {         
      if (isEnabled()) {
         final Message message = new Message();
         message.setTo(session.getAddress());
         message.setFrom(serverAddress);
         message.setSubject(getSubject());
         message.setBody(getMessage());

         TimerTask messageTask = new TimerTask() {
            @Override
public void run() {
               router.route(message);
            }
         };

         TaskEngine.getInstance().schedule(messageTask, 5000);
      }
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:19,代码来源:MotDPlugin.java


示例14: savePublishedItem

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
   * Creates and stores the published item in the database. 
   * @param wrapper The published item, wrapped for retry
   */
  private static void savePublishedItem(RetryWrapper wrapper) {
  	boolean firstPass = (wrapper.getRetryCount() == 0);
  	PublishedItem item = wrapper.get();
String itemKey = item.getItemKey();
itemCache.put(itemKey, item);
log.debug("Added new (inbound) item to cache");
      synchronized (itemsPending) {
  		LinkedListNode<RetryWrapper> itemToReplace = itemsPending.remove(itemKey);
  		if (itemToReplace != null) {
  			itemToReplace.remove(); // remove duplicate from itemsToAdd linked list
  		}
  		LinkedListNode<RetryWrapper> listNode = firstPass ? 
  							itemsToAdd.addLast(wrapper) : 
  							itemsToAdd.addFirst(wrapper);
  		itemsPending.put(itemKey, listNode);
      }
      // skip the flush step if this is a retry attempt
if (firstPass && itemsPending.size() > MAX_ITEMS_FLUSH) {
	TaskEngine.getInstance().submit(new Runnable() {
		public void run() { flushPendingItems(false); }
	});
}
  }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:28,代码来源:PubSubPersistenceManager.java


示例15: failDelivery

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private void failDelivery(final Collection<Packet> packets) {
     if (packets == null) {
         // Do nothing if someone asked to deliver nothing :)
         return;
     }
     // use a separate thread to schedule backup delivery
		TaskEngine.getInstance().submit(new Runnable() {
public void run() {
       for (Packet packet : packets) {
 	            try {
     				backupDeliverer.deliver(packet);
 	            }
 	            catch (UnauthorizedException e) {
 	                Log.error("Unable to deliver message to backup deliverer", e);
 	            }
       }
}
		});
 }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:20,代码来源:HttpSession.java


示例16: start

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@Override
public void start() {
    XMPPServer.getInstance().addServerListener( this );

    // Run through the users every 5 minutes after a 5 minutes server startup delay (default
    // values)
    userTimeoutTask = new UserTimeoutTask();
    TaskEngine.getInstance().schedule(userTimeoutTask, user_timeout, user_timeout);
    // Log the room conversations every 5 minutes after a 5 minutes server startup delay
    // (default values)
    logConversationTask = new LogConversationTask();
    TaskEngine.getInstance().schedule(logConversationTask, log_timeout, log_timeout);
    // Remove unused rooms from memory
    cleanupTask = new CleanupTask();
    TaskEngine.getInstance().schedule(cleanupTask, CLEANUP_FREQUENCY, CLEANUP_FREQUENCY);

    // Set us up to answer disco item requests
    XMPPServer.getInstance().getIQDiscoItemsHandler().addServerItemsProvider(this);
    XMPPServer.getInstance().getIQDiscoInfoHandler().setServerNodeInfoProvider(this.getServiceDomain(), this);
    XMPPServer.getInstance().getServerItemsProviders().add(this);

    ArrayList<String> params = new ArrayList<>();
    params.clear();
    params.add(getServiceDomain());
    Log.info(LocaleUtils.getLocalizedString("startup.starting.muc", params));
    // Load all the persistent rooms to memory
    for (LocalMUCRoom room : MUCPersistenceManager.loadRoomsFromDB(this, this.getCleanupDate(), router)) {
        localMUCRoomManager.addRoom(room.getName().toLowerCase(),room);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:MultiUserChatServiceImpl.java


示例17: QueuedTasksManager

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
/**
 * Hide the constructor so no one can create other instances
 */
private QueuedTasksManager() {
    // Register a periodic task that will execute queued tasks
    TaskEngine.getInstance().scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            if (!ClusterManager.isClusteringStarting()) {
                MUCRoomTask mucRoomTask;
                while ((mucRoomTask = taskQueue.poll()) != null) {
                    mucRoomTask.run();
                }
            }
        }
    }, 1000, 30000);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:18,代码来源:QueuedTasksManager.java


示例18: PacketCopier

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
private PacketCopier() {
    // Add the new instance as a listener of component events. We need to react when
    // a component is no longer valid
    InternalComponentManager.getInstance().addListener(this);
    XMPPServer server = XMPPServer.getInstance();
    serverName = server.getServerInfo().getXMPPDomain();
    routingTable = server.getRoutingTable();

    // Add new instance to the PacketInterceptors list
    InterceptorManager.getInstance().addInterceptor(this);

    // Create a new task and schedule it with the new timeout
    packetsTask = new ProcessPacketsTask();
    TaskEngine.getInstance().schedule(packetsTask, 5000, 5000);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:16,代码来源:PacketCopier.java


示例19: onConnect

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@OnWebSocketConnect
public void onConnect(Session session)
{
    wsSession = session;
    wsConnection = new WebSocketConnection(this, session.getRemoteAddress());
    pingTask = new PingTask();
    TaskEngine.getInstance().schedule(pingTask, JiveConstants.MINUTE, JiveConstants.MINUTE);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:XmppWebSocket.java


示例20: start

import org.jivesoftware.util.TaskEngine; //导入依赖的package包/类
@Override
public void start() throws IllegalStateException {
    super.start();
    localSessionManager.start();
    // Run through the server sessions every 3 minutes after a 3 minutes server startup delay (default values)
    int period = 3 * 60 * 1000;
    TaskEngine.getInstance().scheduleAtFixedRate(new DetachedCleanupTask(), period, period);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:SessionManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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