public SessionConnector(SessionSettings settings, SessionFactory sessionFactory) throws ConfigError { this.settings = settings; this.sessionFactory = sessionFactory; if (settings == null) { throw new ConfigError("no settings"); } }
public Derived withQueueWatermarks(int lower, int upper) throws ConfigError { if (queueCapacity >= 0) { throw new ConfigError("queue capacity and watermarks may not be configured together"); } else if (lower < 0 || upper <= lower) { throw new ConfigError("invalid queue watermarks, required: 0 <= lower watermark < upper watermark"); } queueLowerWatermark = lower; queueUpperWatermark = upper; return derived.cast(this); }
public Derived withQueueCapacity(int val) throws ConfigError { if (queueLowerWatermark >= 0) { throw new ConfigError("queue capacity and watermarks may not be configured together"); } else if (val < 0) { throw new ConfigError("negative queue capacity"); } queueCapacity = val; return derived.cast(this); }
private void addFieldName(int field, String name) throws ConfigError { if (names.put(name, field) != null) { throw new ConfigError("Field named " + name + " defined multiple times"); } fieldNames.put(field, name); }
public String getString(String key) throws ConfigError, FieldConvertError { try { return data.get(key).toString(); } catch (NullPointerException e) { throw new ConfigError("No value for key: " + key); } }
public int getDay(String key) throws ConfigError, FieldConvertError { Object datum = data.get(key); if (datum == null) { throw new ConfigError("No value for key."); } if (datum instanceof String) { return DayConverter.toInteger((String) datum); } throw new ConfigError("Invalid data type for day value: " + datum.getClass().getName()); }
public long getLong(String key) throws ConfigError, FieldConvertError { try { return (Long) data.get(key); } catch (ClassCastException e) { throw new FieldConvertError("Incorrect data type"); } catch (NullPointerException e) { throw new ConfigError("No value for key: " + key); } }
public boolean getBool(String key) throws ConfigError, FieldConvertError { try { return (Boolean) data.get(key); } catch (ClassCastException e) { throw new FieldConvertError("Incorrect data type"); } catch (NullPointerException e) { throw new ConfigError("No value for key: " + key); } }
public SocketInitiator(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, LogFactory logFactory, MessageFactory messageFactory) throws ConfigError { super(application, messageStoreFactory, settings, logFactory, messageFactory); if (settings == null) { throw new ConfigError("no settings"); } eventHandlingStrategy = new SingleThreadedEventHandlingStrategy(this, DEFAULT_QUEUE_CAPACITY); }
public SocketInitiator(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, LogFactory logFactory, MessageFactory messageFactory, int queueCapacity) throws ConfigError { super(application, messageStoreFactory, settings, logFactory, messageFactory); if (settings == null) { throw new ConfigError("no settings"); } eventHandlingStrategy = new SingleThreadedEventHandlingStrategy(this, queueCapacity); }
public double getDouble(String key) throws ConfigError, FieldConvertError { try { return (Double) data.get(key); } catch (ClassCastException e) { throw new FieldConvertError("Incorrect data type"); } catch (NullPointerException e) { throw new ConfigError("No value for key: " + key); } }
public static SocketAddress createSocketAddress(int transportType, String host, int port) throws ConfigError { if (transportType == SOCKET || transportType == PROXY) { return host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port); } else if (transportType == VM_PIPE) { return new VmPipeAddress(port); } else { throw new ConfigError("Unknown session transport type: " + transportType); } }
private int lookupXMLFieldNumber(Document document, Node node) throws ConfigError { final Element element = (Element) node; if (!element.hasAttribute("name")) { throw new ConfigError("No name given to field"); } return lookupXMLFieldNumber(document, element.getAttribute("name")); }
public static IoConnector createIoConnector(SocketAddress address) throws ConfigError { if (address instanceof InetSocketAddress) { return new NioSocketConnector(); } else if (address instanceof VmPipeAddress) { return new VmPipeConnector(); } else { throw new ConfigError("Unknown session acceptor address type: " + address.getClass().getName()); } } }
public SessionSchedule create(SessionID sessionID, SessionSettings settings) throws ConfigError { try { return new DefaultSessionSchedule(settings, sessionID); } catch (final FieldConvertError e) { throw new ConfigError(e.getMessage()); } } }
public SocketInitiator(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, MessageFactory messageFactory) throws ConfigError { super(application, messageStoreFactory, settings, new ScreenLogFactory(settings), messageFactory); if (settings == null) { throw new ConfigError("no settings"); } eventHandlingStrategy = new SingleThreadedEventHandlingStrategy(this, DEFAULT_QUEUE_CAPACITY); }
public SocketInitiator(Application application, MessageStoreFactory messageStoreFactory, SessionSettings settings, MessageFactory messageFactory, int queueCapacity) throws ConfigError { super(application, messageStoreFactory, settings, new ScreenLogFactory(settings), messageFactory); if (settings == null) { throw new ConfigError("no settings"); } eventHandlingStrategy = new SingleThreadedEventHandlingStrategy(this, queueCapacity); }
protected void createSessionInitiators() throws ConfigError { try { createSessions(); for (final Session session : getSessionMap().values()) { createInitiator(session); } } catch (final FieldConvertError e) { throw new ConfigError(e); } }
protected int getIntSetting(String key) throws ConfigError { try { return IntConverter.convert(settings.getString(key)); } catch (FieldConvertError e) { throw (ConfigError) new ConfigError(e.getMessage()).fillInStackTrace(); } }
public void createDynamicSession(SessionID sessionID) throws ConfigError { try { Session session = createSession(sessionID); super.addDynamicSession(session); createInitiator(session); startInitiators(); } catch (final FieldConvertError e) { throw new ConfigError(e); } }