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

Java JiveConstants类代码示例

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

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



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

示例1: logEvent

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
/**
 * The default provider logs events into a ofSecurityAuditLog table in the database.
 * @see org.jivesoftware.openfire.security.SecurityAuditProvider#logEvent(String, String, String)
 */
@Override
public void logEvent(String username, String summary, String details) {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        long msgID = SequenceManager.nextID(JiveConstants.SECURITY_AUDIT);
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(LOG_ENTRY);
        pstmt.setLong(1, msgID);
        pstmt.setString(2, username);
        pstmt.setLong(3, new Date().getTime());
        pstmt.setString(4, StringUtils.abbreviate(summary, 250));
        pstmt.setString(5, XMPPServer.getInstance().getServerInfo().getHostname());
        pstmt.setString(6, details);
        pstmt.executeUpdate();
    }
    catch (SQLException e) {
        Log.warn("Error trying to insert a new row in ofSecurityAuditLog: ", e);
    }
    finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:28,代码来源:DefaultSecurityAuditProvider.java


示例2: insertService

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
/**
 * Inserts a new MUC service into the database.
 * @param subdomain Subdomain of new service.
 * @param description Description of MUC service.  Can be null for default description.
 * @param isHidden True if the service should be hidden from service listing.
 */
private void insertService(String subdomain, String description, Boolean isHidden) {
    Connection con = null;
    PreparedStatement pstmt = null;
    Long serviceID = SequenceManager.nextID(JiveConstants.MUC_SERVICE);
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(CREATE_SERVICE);
        pstmt.setLong(1, serviceID);
        pstmt.setString(2, subdomain);
        if (description != null) {
            pstmt.setString(3, description);
        }
        else {
            pstmt.setNull(3, Types.VARCHAR);
        }
        pstmt.setInt(4, (isHidden ? 1 : 0));
        pstmt.executeUpdate();
    }
    catch (SQLException e) {
        Log.error(e.getMessage(), e);
    }
    finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:MultiUserChatManager.java


示例3: run

import org.jivesoftware.util.JiveConstants; //导入依赖的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


示例4: start

import org.jivesoftware.util.JiveConstants; //导入依赖的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


示例5: run

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public void run() {
    long currentTime = System.currentTimeMillis();
    for (HttpSession session : sessionMap.values()) {
        try {
            long lastActive = currentTime - session.getLastActivity();
            if (Log.isDebugEnabled()) {
                Log.debug("Session was last active " + lastActive + " ms ago: " + session.getAddress());
            }
            if (lastActive > session.getInactivityTimeout() * JiveConstants.SECOND) {
                Log.info("Closing idle session: " + session.getAddress());
                session.close();
            }
        } catch (Exception e) {
            Log.error("Failed to determine idle state for session: " + session, e);
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:HttpSessionManager.java


示例6: ConnectionMultiplexerManager

import org.jivesoftware.util.JiveConstants; //导入依赖的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


示例7: getGroupCount

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public int getGroupCount() {
    if (manager.isDebugEnabled()) {
        Log.debug("LdapGroupProvider: Trying to get the number of groups in the system.");
    }
    // Cache user count for 5 minutes.
    if (groupCount != -1 && System.currentTimeMillis() < expiresStamp) {
        return groupCount;
    }
    this.groupCount = manager.retrieveListCount(
            manager.getGroupNameField(),
            MessageFormat.format(manager.getGroupSearchFilter(), "*")
    );
    this.expiresStamp = System.currentTimeMillis() + JiveConstants.MINUTE *5;
    return this.groupCount;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:LdapGroupProvider.java


示例8: getMaxLifetimeFromProperty

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
private static long getMaxLifetimeFromProperty(CacheInfo cacheInfo) {
    String lifetimeProp = cacheInfo.getParams().get("back-expiry");
    if (lifetimeProp != null) {
        if ("0".equals(lifetimeProp)) {
            return -1l;
        }
        long factor = 1;
        if (lifetimeProp.endsWith("m")) {
            factor = JiveConstants.MINUTE;
        }
        else if (lifetimeProp.endsWith("h")) {
            factor = JiveConstants.HOUR;
        }
        else if (lifetimeProp.endsWith("d")) {
            factor = JiveConstants.DAY;
        }
        try {
            return Long.parseLong(lifetimeProp.substring(0, lifetimeProp.length()-1)) * factor;
        }
        catch (NumberFormatException nfe) {
            Log.warn("Unable to parse back-expiry for cache: " + cacheInfo.getCacheName());
        }
    }
    // Return default
    return CacheFactory.DEFAULT_MAX_CACHE_LIFETIME;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:PluginCacheRegistry.java


示例9: start

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public void start() {
    File databaseDir = new File(JiveGlobals.getHomeDirectory(), File.separator + "embedded-db");
    // If the database doesn't exist, create it.
    if (!databaseDir.exists()) {
        databaseDir.mkdirs();
    }

    try {
        serverURL = "jdbc:hsqldb:" + databaseDir.getCanonicalPath() + File.separator + "openfire";
    }
    catch (IOException ioe) {
        Log.error("EmbeddedConnectionProvider: Error starting connection pool: ", ioe);
    }
    final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(serverURL, "sa", "");
    final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
    poolableConnectionFactory.setMaxConnLifetimeMillis((long) (0.5 * JiveConstants.DAY));

    final GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMinIdle(3);
    poolConfig.setMaxTotal(25);
    final GenericObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(poolableConnectionFactory, poolConfig);
    poolableConnectionFactory.setPool(connectionPool);
    dataSource = new PoolingDataSource<>(connectionPool);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:EmbeddedConnectionProvider.java


示例10: propertyDeleted

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
public void propertyDeleted(String property, Map<String, Object> params) {
    if (property.equals("conversation.metadataArchiving")) {
        metadataArchivingEnabled = true;
    } else if (property.equals("conversation.messageArchiving")) {
        messageArchivingEnabled = false;
    } else if (property.equals("conversation.roomArchiving")) {
        roomArchivingEnabled = false;
    } else if (property.equals("conversation.roomArchivingStanzas")) {
        roomArchivingStanzasEnabled = false;
    } else if (property.equals("conversation.roomsArchived")) {
        roomsArchived = Collections.emptyList();
    } else if (property.equals("conversation.idleTime")) {
        idleTime = DEFAULT_IDLE_TIME * JiveConstants.MINUTE;
    } else if (property.equals("conversation.maxTime")) {
        maxTime = DEFAULT_MAX_TIME * JiveConstants.MINUTE;
    } else if (property.equals("conversation.maxAge")) {
        maxAge = DEFAULT_MAX_AGE * JiveConstants.DAY;
    } else if (property.equals("conversation.maxRetrievable")) {
        maxRetrievable = DEFAULT_MAX_RETRIEVABLE * JiveConstants.DAY;
    }  else if (property.equals("conversation.maxTimeDebug")) {
        Log.info("Monitoring plugin max time reset back to " + DEFAULT_MAX_TIME + " minutes");
        maxTime = DEFAULT_MAX_TIME * JiveConstants.MINUTE;
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:ConversationManager.java


示例11: logEvent

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
/**
 * The default provider logs events into a ofSecurityAuditLog table in the database.
 * @see org.jivesoftware.openfire.security.SecurityAuditProvider#logEvent(String, String, String)
 */
public void logEvent(String username, String summary, String details) {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        long msgID = SequenceManager.nextID(JiveConstants.SECURITY_AUDIT);
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(LOG_ENTRY);
        pstmt.setLong(1, msgID);
        pstmt.setString(2, username);
        pstmt.setLong(3, new Date().getTime());
        pstmt.setString(4, StringUtils.abbreviate(summary, 250));
        pstmt.setString(5, XMPPServer.getInstance().getServerInfo().getHostname());
        pstmt.setString(6, details);
        pstmt.executeUpdate();
    }
    catch (SQLException e) {
        Log.warn("Error trying to insert a new row in ofSecurityAuditLog: ", e);
    }
    finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:27,代码来源:DefaultSecurityAuditProvider.java


示例12: ConnectionMultiplexerManager

import org.jivesoftware.util.JiveConstants; //导入依赖的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


示例13: waitForResponse

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
private String waitForResponse() throws HttpBindTimeoutException {
      // we enter this method when we have no messages pending delivery
// when we resume a suspended continuation, or when we time out
if (continuation.isInitial()) {
    continuation.setTimeout(session.getWait() * JiveConstants.SECOND);
          continuation.suspend();
          continuation.undispatch();
      } else if (continuation.isResumed()) {
          // This will occur when the hold attribute of a session has been exceeded.
          String deliverable = (String) continuation.getAttribute(RESPONSE_BODY);
          if (deliverable == null) {
              throw new HttpBindTimeoutException();
          }
          else if(CONNECTION_CLOSED.equals(deliverable)) {
              return null;
          }
          return deliverable;
      }

      throw new HttpBindTimeoutException("Request " + requestId + " exceeded response time from " +
              "server of " + session.getWait() + " seconds.");
  }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:23,代码来源:HttpConnection.java


示例14: run

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public void run() {
          long currentTime = System.currentTimeMillis();
          for (HttpSession session : sessionMap.values()) {
              long lastActive = currentTime - session.getLastActivity();
              if (Log.isDebugEnabled()) {
              	Log.debug("Session was last active " + lastActive + " ms ago: " + session.getAddress());
              }
              if (lastActive > session.getInactivityTimeout() * JiveConstants.SECOND) {
              	Log.info("Closing idle session: " + session.getAddress());
                  session.close();
              }
          }
      }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:15,代码来源:HttpSessionManager.java


示例15: propertyDeleted

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
public void propertyDeleted(String property, Map<String, Object> params) {
	if (property.equals("conversation.metadataArchiving")) {
		metadataArchivingEnabled = true;
	} else if (property.equals("conversation.messageArchiving")) {
		messageArchivingEnabled = false;
	} else if (property.equals("conversation.roomArchiving")) {
		roomArchivingEnabled = false;
	} else if (property.equals("conversation.roomsArchived")) {
		roomsArchived = Collections.emptyList();
	} else if (property.equals("conversation.idleTime")) {
		idleTime = DEFAULT_IDLE_TIME * JiveConstants.MINUTE;
	} else if (property.equals("conversation.maxTime")) {
		maxTime = DEFAULT_MAX_TIME * JiveConstants.MINUTE;
	} else if (property.equals("conversation.maxAge")) {
		maxAge = DEFAULT_MAX_AGE * JiveConstants.DAY;
	} else if (property.equals("conversation.maxRetrievable")) {
		maxRetrievable = DEFAULT_MAX_RETRIEVABLE * JiveConstants.DAY;
	}

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


示例16: propertyDeleted

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
public void propertyDeleted(String property, Map<String, Object> params) {
    if (property.equals("conversation.metadataArchiving")) {
        metadataArchivingEnabled = true;
    }
    else if (property.equals("conversation.messageArchiving")) {
        messageArchivingEnabled = false;
    }
    else if (property.equals("conversation.roomArchiving")) {
        roomArchivingEnabled = false;
    }
    else if (property.equals("conversation.roomsArchived")) {
        roomsArchived = Collections.emptyList();
    }
    else if (property.equals("conversation.idleTime")) {
        idleTime = DEFAULT_IDLE_TIME * JiveConstants.MINUTE;
    }
    else if (property.equals("conversation.maxTime")) {
        maxTime = DEFAULT_MAX_TIME * JiveConstants.MINUTE;
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:21,代码来源:ConversationManager.java


示例17: getID

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public long getID() {
    if (isPersistent() || isLogEnabled()) {
        if (roomID == -1) {
            roomID = SequenceManager.nextID(JiveConstants.MUC_ROOM);
        }
    }
    return roomID;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:10,代码来源:LocalMUCRoom.java


示例18: onConnect

import org.jivesoftware.util.JiveConstants; //导入依赖的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


示例19: initializePool

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
private synchronized void initializePool() {
    if (readerPool == null) {
        readerPool = new GenericObjectPool<XMPPPacketReader>(new XMPPPPacketReaderFactory());
        readerPool.setMaxTotal(-1);
        readerPool.setBlockWhenExhausted(false);
        readerPool.setTestOnReturn(true);
        readerPool.setTimeBetweenEvictionRunsMillis(JiveConstants.MINUTE);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:10,代码来源:XmppWebSocket.java


示例20: createItem

import org.jivesoftware.util.JiveConstants; //导入依赖的package包/类
@Override
public RosterItem createItem(String username, RosterItem item)
        throws UserAlreadyExistsException
{
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        long rosterID = SequenceManager.nextID(JiveConstants.ROSTER);
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(CREATE_ROSTER_ITEM);
        pstmt.setString(1, username);
        pstmt.setLong(2, rosterID);
        pstmt.setString(3, item.getJid().toBareJID());
        pstmt.setInt(4, item.getSubStatus().getValue());
        pstmt.setInt(5, item.getAskStatus().getValue());
        pstmt.setInt(6, item.getRecvStatus().getValue());
        pstmt.setString(7, item.getNickname());
        pstmt.executeUpdate();

        item.setID(rosterID);
        insertGroups(rosterID, item.getGroups().iterator(), con);
    }
    catch (SQLException e) {
        Log.warn("Error trying to insert a new row in ofRoster", e);
        throw new UserAlreadyExistsException(item.getJid().toBareJID());
    }
    finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
    return item;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:DefaultRosterItemProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ReactRawTextManager类代码示例发布时间:2022-05-22
下一篇:
Java MarkerOptions类代码示例发布时间: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