/** * Create new {@link org.glassfish.tyrus.core.TyrusWebSocketEngine} instance with current set of parameters. * * @return new {@link org.glassfish.tyrus.core.TyrusWebSocketEngine} instance. */ public TyrusWebSocketEngine build() { if (maxSessionsPerApp != null && maxSessionsPerApp <= 0) { LOGGER.log(Level.CONFIG, "Invalid configuration value " + MAX_SESSIONS_PER_APP + " (" + maxSessionsPerApp + "), expected value greater than 0."); maxSessionsPerApp = null; } if (maxSessionsPerRemoteAddr != null && maxSessionsPerRemoteAddr <= 0) { LOGGER.log(Level.CONFIG, "Invalid configuration value " + MAX_SESSIONS_PER_REMOTE_ADDR + " (" + maxSessionsPerRemoteAddr + "), expected value greater than 0."); maxSessionsPerRemoteAddr = null; } if (maxSessionsPerApp != null && maxSessionsPerRemoteAddr != null && maxSessionsPerApp < maxSessionsPerRemoteAddr) { LOGGER.log(Level.FINE, String.format("Invalid configuration - value %s (%d) cannot be greater then %s (%d).", MAX_SESSIONS_PER_REMOTE_ADDR, maxSessionsPerRemoteAddr, MAX_SESSIONS_PER_APP, maxSessionsPerApp)); } return new TyrusWebSocketEngine(webSocketContainer, incomingBufferSize, clusterContext, applicationEventListener, maxSessionsPerApp, maxSessionsPerRemoteAddr, tracingType, tracingThreshold, parallelBroadcastEnabled); }
/** * Create new {@link org.glassfish.tyrus.core.TyrusWebSocketEngine} instance with current set of parameters. * * @return new {@link org.glassfish.tyrus.core.TyrusWebSocketEngine} instance. */ public TyrusWebSocketEngine build() { if (maxSessionsPerApp != null && maxSessionsPerApp <= 0) { LOGGER.log(Level.CONFIG, "Invalid configuration value " + MAX_SESSIONS_PER_APP + " (" + maxSessionsPerApp + "), expected value greater than 0."); maxSessionsPerApp = null; } if (maxSessionsPerRemoteAddr != null && maxSessionsPerRemoteAddr <= 0) { LOGGER.log(Level.CONFIG, "Invalid configuration value " + MAX_SESSIONS_PER_REMOTE_ADDR + " (" + maxSessionsPerRemoteAddr + "), expected value greater than 0."); maxSessionsPerRemoteAddr = null; } if (maxSessionsPerApp != null && maxSessionsPerRemoteAddr != null && maxSessionsPerApp < maxSessionsPerRemoteAddr) { LOGGER.log(Level.FINE, String.format("Invalid configuration - value %s (%d) cannot be greater then %s (%d).", MAX_SESSIONS_PER_REMOTE_ADDR, maxSessionsPerRemoteAddr, MAX_SESSIONS_PER_APP, maxSessionsPerApp)); } return new TyrusWebSocketEngine(webSocketContainer, incomingBufferSize, clusterContext, applicationEventListener, maxSessionsPerApp, maxSessionsPerRemoteAddr, tracingType, tracingThreshold, parallelBroadcastEnabled); }