@Override public synchronized void stop() { if (!live) { return; } live = false; logger.finest("Stopping ConnectionManager"); if (acceptorThread != null) { acceptorThread.shutdown(); } for (SocketChannelWrapper socketChannel : acceptedSockets) { closeResource(socketChannel); } for (Connection conn : connectionsMap.values()) { destroySilently(conn); } for (TcpIpConnection conn : activeConnections) { destroySilently(conn); } ioThreadingModel.shutdown(); acceptedSockets.clear(); connectionsInProgress.clear(); connectionsMap.clear(); monitors.clear(); activeConnections.clear(); }
@Override public void clear() { table.clear(); nameUniqueIndex.clear(); parentIndex.clear(); addSubject(FundsMutationSubject.getCurrencyConversionDifferenceSubject(INSTANCE)); }
public List<Events> getEventsByParams() { ConcurrentHashMap<Integer, Events> eventBeforeSearch = AppStorage.INSTANCE.getEventStorageCopy(); ConcurrentHashMap<Integer, Events> eventAfterSearch = new ConcurrentHashMap<Integer, Events>(); if (city != null && city.length() != 0) { for (Map.Entry<Integer, Events> entry : eventBeforeSearch.entrySet()) { if (city.equalsIgnoreCase(entry.getValue().getCity())) eventAfterSearch.put(entry.getKey(), entry.getValue()); } } eventBeforeSearch.clear(); eventBeforeSearch = AppStorage.INSTANCE.getEventStorageCopy(); if (description != null && description.length() > 0 && !description.equals("")) { eventAfterSearch.clear(); for (Map.Entry<Integer, Events> entry : eventBeforeSearch.entrySet()) { if (entry.getValue().getDescription().contains(description)) eventAfterSearch.put(entry.getKey(), entry.getValue()); } } eventBeforeSearch = new ConcurrentHashMap<Integer, Events>(eventAfterSearch); /* if(date != null){ for(Map.Entry<Integer,Events> entry : eventBeforeSearch.entrySet()){ GregorianCalendar eventDate = entry.getValue().getDate(); GregorianCalendar before = new GregorianCalendar(eventDate.get(1),eventDate.get(2),eventDate.get(4)+1); GregorianCalendar after = new GregorianCalendar(eventDate.get(1),eventDate.get(2),eventDate.get(4)); if(date.after(after) && date.before(before)) eventAfterSearch.put(entry.getKey(),entry.getValue()); } } */ return new ArrayList<Events>(eventAfterSearch.values()); }
public void reset() { inputEvents.clear(); inputEventSignatures.clear(); inputEventRegistrationsValid.clear(); outputEvents.clear(); listeners.clear(); }
/** * We need to make sure that all resources are closed, we don't actually do this when a * resourceConfig is closed but maybe we should. */ public void stop() { for (RecoveryDiscovery recoveryDiscovery : configSet.values()) { recoveryDiscovery.stop(); } for (HornetQXAResourceWrapper hornetQXAResourceWrapper : recoveries.values()) { hornetQXAResourceWrapper.close(); } recoveries.clear(); configSet.clear(); }
/** Stops loading images, kills the image loader thread and clears all caches. */ public void stop() { pause(); if (mLoaderThread != null) { mLoaderThread.quit(); mLoaderThread = null; } mPendingRequests.clear(); mBitmapCache.clear(); }
/** * Connect to server. * * @param wsUri WebSockets server URI. * @param sessionHandler The session handler to fire callbacks on. * @param headers The headers for connection */ public void connect( String wsUri, Wamp.ConnectionHandler sessionHandler, WampOptions options, List<BasicNameValuePair> headers) { mSessionHandler = sessionHandler; mCalls.clear(); mSubs.clear(); mOutgoingPrefixes.clear(); try { connect( wsUri, new String[] {"wamp"}, new WebSocketConnectionHandler() { @Override public void onOpen() { if (mSessionHandler != null) { mSessionHandler.onOpen(); } else { if (DEBUG) Log.d(TAG, "could not call onOpen() .. handler already NULL"); } } @Override public void onClose(int code, String reason) { if (mSessionHandler != null) { mSessionHandler.onClose(code, reason); } else { if (DEBUG) Log.d(TAG, "could not call onClose() .. handler already NULL"); } } }, options, headers); } catch (WebSocketException e) { if (mSessionHandler != null) { mSessionHandler.onClose( WebSocketConnectionHandler.CLOSE_CANNOT_CONNECT, "cannot connect (" + e.toString() + ")"); } else { if (DEBUG) Log.d(TAG, "could not call onClose() .. handler already NULL"); } } }
/** * Test onAddChatWindow * * @throws IllegalArgumentException * @throws NoSuchFieldException * @throws IllegalAccessException */ public void testCase02_onAddChatWindow() throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException { Logger.d(TAG, "testCase02_onAddChatWindow"); ConcurrentHashMap<IChatWindow, IChatWindowMessage> chatWindowMap = getChatWindowMapFiled(); chatWindowMap.clear(); mReceivedChatMessage.onAddChatWindow(null); assertTrue(chatWindowMap.size() == 0); mOneOneWindow.mShouldAddSentMessage = false; mReceivedChatMessage.onAddChatWindow(mOneOneWindow); assertTrue(chatWindowMap.size() == 0); mOneOneWindow.mShouldAddSentMessage = true; mReceivedChatMessage.onAddChatWindow(mOneOneWindow); assertTrue(chatWindowMap.containsKey(mOneOneWindow)); chatWindowMap.clear(); }
/** handle actual disconnecting - from ui thread only */ void doDisconnect() { mState = State.kDisconnecting; for (RoomObserver obs : mObservers) { obs.onRoomDisconnected(); } Set<String> keyset = mRemoteStream.keySet(); for (String key : keyset) { StreamDescription stream = (StreamDescription) mRemoteStream.get(key); removeStream(stream); triggerStreamRemoved(stream); } mRemoteStream.clear(); if (mLocalStream.size() > 0) { unpublish(); } synchronized (mSocketLock) { if (mIoClient != null) { mIoClient.disconnect(); mIoClient = null; } } mState = State.kDisconnected; }
public static void removeAll() { for (Player player : instances.keySet()) { WaterReturn wr = instances.get(player); if (wr.block != null) wr.block.revertBlock(); } instances.clear(); }
private void loadOfflineHosts() { mClusterManager.clearItems(); mClusterManager.getMarkerCollection().clear(); mHosts.clear(); mClusterManager.addItems(starredHosts); mClusterManager.cluster(); }
public void clear() { root = null; nodes.clear(); ephemerals.clear(); // dataWatches = null; // childWatches = null; }
public void deserialize(InputArchive ia, String tag) throws IOException { deserializeList(longKeyMap, ia); nodes.clear(); String path = ia.readString("path"); while (!path.equals("/")) { DataNode node = new DataNode(); ia.readRecord(node, "node"); nodes.put(path, node); int lastSlash = path.lastIndexOf('/'); if (lastSlash == -1) { root = node; } else { String parentPath = path.substring(0, lastSlash); node.parent = nodes.get(parentPath); node.parent.children.add(path.substring(lastSlash + 1)); long eowner = node.stat.getEphemeralOwner(); if (eowner != 0) { HashSet<String> list = ephemerals.get(eowner); if (list == null) { list = new HashSet<String>(); ephemerals.put(eowner, list); } list.add(path); } } path = ia.readString("path"); } nodes.put("/", root); // we are done with deserializing the // the datatree // update the quotas - create path trie // and also update the stat nodes setupQuota(); }
/** empty the WMSCache */ public void empty() { synchronized (counterLock) { cacheSize = 0; counter = new CountDownLatch(1); } cache.clear(); }
/** * Populates the internal collection of registered {@link AuthScheme authentication schemes} with * the content of the map passed as a parameter. * * @param map authentication schemes */ public void setItems(final Map<String, AuthSchemeFactory> map) { if (map == null) { return; } registeredSchemes.clear(); registeredSchemes.putAll(map); }
private void unbind() { if (mBound) { mBound = false; mContext.unbindService(mConnection); mUpdatesMap.clear(); } }
@Override public void close() { for (OScheduledEvent event : events.values()) { event.interrupt(); } events.clear(); }
public void stopSingleSongs() { for (Entry<Song, PlayerController> entry : singleSongPlayers.entrySet()) { PlayerController controller = entry.getValue(); controller.close(true); } singleSongPlayers.clear(); }
public static void removeAll() { for (int id : instances.keySet()) { instances.get(id).cancel(); } instances.clear(); }
@Override public void close() throws BackendException { for (InMemoryKeyColumnValueStore store : stores.values()) { store.close(); } stores.clear(); }
/** Reread data from disk. */ public void refresh() { if (profileFile.lastModified() > profileFileLastModified) { profileFileLastModified = profileFile.lastModified(); allProfiles = loadProfiles(profileFile); } credentialProviderCache.clear(); }
/** {@inheritDoc} */ public synchronized void destroy() { String s = config.getInitParameter(ApplicationConfig.SHARED); if (s != null && s.equalsIgnoreCase("true")) { logger.warn( "Factory shared, will not be destroyed. That can possibly cause memory leaks if" + "Broadcaster where created. Make sure you destroy them manually."); return; } Enumeration<Broadcaster> e = store.elements(); Broadcaster b; // We just need one when shared. BroadcasterConfig bc = null; while (e.hasMoreElements()) { try { b = e.nextElement(); b.resumeAll(); b.destroy(); bc = b.getBroadcasterConfig(); } catch (Throwable t) { // Shield us from any bad behaviour logger.trace("Destroy", t); } } try { if (bc != null) bc.forceDestroy(); } catch (Throwable t) { logger.trace("Destroy", t); } store.clear(); factory = null; }
private void loadShops() { stopShopCheck(); shops.clear(); FileConfiguration sh = hc.gYH().gFC("shops"); if (!useShops) { Shop shop = new ServerShop("GlobalShop", getGlobalShopAccount().getEconomy(), getGlobalShopAccount()); shop.setGlobal(); shops.put("GlobalShop", shop); return; } Iterator<String> it = sh.getKeys(false).iterator(); while (it.hasNext()) { Object element = it.next(); String name = element.toString(); if (name.equalsIgnoreCase("GlobalShop")) { continue; } String owner = sh.getString(name + ".owner"); String economy = sh.getString(name + ".economy"); if (owner == null) { owner = getGlobalShopAccount().getName(); } if (owner.equalsIgnoreCase(getGlobalShopAccount().getName())) { Shop shop = new ServerShop(name, economy, getHyperPlayer(owner)); shop.setPoint1( sh.getString(name + ".world"), sh.getInt(name + ".p1.x"), sh.getInt(name + ".p1.y"), sh.getInt(name + ".p1.z")); shop.setPoint2( sh.getString(name + ".world"), sh.getInt(name + ".p2.x"), sh.getInt(name + ".p2.y"), sh.getInt(name + ".p2.z")); shop.setMessage1(sh.getString(name + ".shopmessage1")); shop.setMessage2(sh.getString(name + ".shopmessage2")); shops.put(name, shop); } else { if (hc.gYH().gFC("config").getBoolean("config.use-player-shops")) { Shop shop = new PlayerShop(name, economy, getHyperPlayer(owner)); shop.setPoint1( sh.getString(name + ".world"), sh.getInt(name + ".p1.x"), sh.getInt(name + ".p1.y"), sh.getInt(name + ".p1.z")); shop.setPoint2( sh.getString(name + ".world"), sh.getInt(name + ".p2.x"), sh.getInt(name + ".p2.y"), sh.getInt(name + ".p2.z")); shop.setMessage1(sh.getString(name + ".shopmessage1")); shop.setMessage2(sh.getString(name + ".shopmessage2")); shops.put(name, shop); } } } startShopCheck(); }
private void loadAffectedBlocks() { affectedblocks.clear(); Block thisblock; for (int i = 1; i <= height; i++) { thisblock = block.getWorld().getBlockAt(location.clone().add(direction.clone().multiply(i))); affectedblocks.put(thisblock, thisblock); } }
public void clear() { if (k1_k2V_map.size() > 0) { for (ConcurrentHashMap<K2, V> k2V_map : k1_k2V_map.values()) { k2V_map.clear(); } k1_k2V_map.clear(); } }
/** dodaje uzytkownikow */ public void addUsers(Collection<User> users) { map.clear(); list.clear(); for (User u : users) { map.put(u.getUsername(), u); list.add(u); } }
/** Update cache. */ private static void updateFormatCache(Long key, String value) { if (value == null) { return; } if (formatCache.size() > CACHE_SIZE) { formatCache.clear(); } formatCache.put(key, value); }
/** Unsubscribe from any subscribed topic. */ public void unsubscribe() { for (String topicUri : mSubs.keySet()) { WampMessage.Unsubscribe msg = new WampMessage.Unsubscribe(topicUri); mWriter.forward(msg); } mSubs.clear(); }
/** Update cache. */ private static void updateParseCache(String key, Long value) { if (value == null) { return; } if (parseCache.size() > CACHE_SIZE) { parseCache.clear(); } parseCache.put(key, value); }
private void load() { for (String key : keys) { if (config.getProperty(key) == null) config.setProperty(key, defaults.get(key)); strings.put(key, config.getString(key).replace("&", "\u00a7")); } // clear defaults to free memory defaults.clear(); }