/** * <code>getParameter()</code> returns stored parameter values * * @param <code>name</code> name of parameter whose value is requested * @return if <code>name</code> is a key in <code>parameters</code>, returns the value associated with <code>name</code>. * Otherwise, returns <code>null</code>. */ public static String getParameter(String name) { return getParameter(name, null); }
public Object firstElement() { return get(0); }
public void send(ChatMessage message) throws TalkConnectionException { outgoingLines.add(message); }
protected ArrayList getBackChat(Object[] args) throws ShuttingDownException { shutDownGate.enter(); ReadWriteArrayList messages = extendedChatInfo.getMessages(); if (messages == null) { System.out.println("messages == null"); messages = new ReadWriteArrayList(); } ArrayList returnMessages = messages.toArrayList(); shutDownGate.leave(); return returnMessages; }
public boolean add(Object o) { gate.enterWrite(); arrayList.add(o); gate.leaveWrite(); return true; }
/** * <code>main()</code> implements unit tests. */ public static void main(String[] args) { initParameters(args); System.out.println("clientUri: " + getParameter("clientUri")); System.out.println("serverUri: " + getParameter("serverUri")); } }
public void run() { while (!locallyShuttingDown && !remotelyShuttingDown) { try { chatServer.send( (ChatMessage) outgoingLines.firstElement()); outgoingLines.remove(0); } catch (RemoteConnectionException re) { System.out.println("RemoteStrategyImpl.createChat(): unable to send next line:"); // System.out.println(" " + (String) outgoingLines.firstElement()); } catch (ShuttingDownException sde) { System.out.println("RemoteStrategyImpl.createChat(): ChatServer is shutting down"); remotelyShuttingDown = true; } } } }
public ShutDownGate() { reset(); }
public ExtendedChatInfo getChat(String key) throws ShuttingDownException { shutDownGate.check(); ExtendedChatInfo eci = (ExtendedChatInfo) extendedChatInfoMap.get(key); return eci; }
public ArrayList copy() { return (ArrayList) subList(0, arrayList.size()); }
public static void main(String[] args) { Parameters.initParameters(args); ChatManagerLauncher chatManagerLauncher = new ChatManagerLauncher(); }
public ExtendedChatInfo(ChatInfo chatInfo) { this.chatInfo = chatInfo; messages = new ReadWriteArrayList(); members = Collections.synchronizedCollection(new HashSet()); threadMap = new Hashtable(); chatReceivers = Collections.synchronizedCollection(new HashSet()); }
public void addMessage(String message) { messages.add(message); }
public RemoteStrategyRemoting() throws Exception { String chatManagerUriString = Parameters.getParameter("chatManagerUri"); if (chatManagerUriString == null) chatManagerUriString = chatManagerLocatorDefault; InvokerLocator chatManagerLocator = new InvokerLocator(chatManagerUriString); managerClient = new Client(chatManagerLocator); managerClient.connect(); }
public void addMessages(ArrayList messages) { Iterator it = messages.iterator(); while (it.hasNext()) { this.messages.add(it.next()); } }