List of usage examples for java.util HashMap values
public Collection<V> values()
From source file:edu.cornell.mannlib.vitro.webapp.dao.jena.IndividualDaoJena.java
/** * In Jena it can be difficult to get an object with a given dataproperty if * you do not care about the datatype or lang of the literal. Use this * method if you would like to ignore the lang and datatype. * /*www . j a va 2 s. c o m*/ * Note: this method doesn't require that a property be declared in the * ontology as a data property -- only that it behaves as one. */ public List<Individual> getIndividualsByDataProperty(String dataPropertyUri, String value) { Property prop = null; if (RDFS.label.getURI().equals(dataPropertyUri)) { prop = RDFS.label; } else { prop = getOntModel().getProperty(dataPropertyUri); } if (prop == null) { log.debug("Could not getIndividualsByDataProperty() " + "because " + dataPropertyUri + "was not found in model."); return Collections.emptyList(); } if (value == null) { log.debug("Could not getIndividualsByDataProperty() " + "because value was null"); return Collections.emptyList(); } Literal litv1 = getOntModel().createLiteral(value); Literal litv2 = getOntModel().createTypedLiteral(value); //warning: this assumes that any language tags will be EN Literal litv3 = getOntModel().createLiteral(value, "EN"); HashMap<String, Individual> individualsMap = new HashMap<String, Individual>(); getOntModel().enterCriticalSection(Lock.READ); int count = 0; try { StmtIterator stmts = getOntModel().listStatements((Resource) null, prop, litv1); while (stmts.hasNext()) { count++; Statement stmt = stmts.nextStatement(); RDFNode sub = stmt.getSubject(); if (sub == null || sub.isAnon() || sub.isLiteral()) continue; RDFNode obj = stmt.getObject(); if (obj == null || !obj.isLiteral()) continue; Literal literal = (Literal) obj; Object v = literal.getValue(); if (v == null) continue; String subUri = ((Resource) sub).getURI(); if (!individualsMap.containsKey(subUri)) { com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri); individualsMap.put(subUri, new IndividualJena(ind, getWebappDaoFactory())); } } stmts = getOntModel().listStatements((Resource) null, prop, litv2); while (stmts.hasNext()) { count++; Statement stmt = stmts.nextStatement(); RDFNode sub = stmt.getSubject(); if (sub == null || sub.isAnon() || sub.isLiteral()) continue; RDFNode obj = stmt.getObject(); if (obj == null || !obj.isLiteral()) continue; Literal literal = (Literal) obj; Object v = literal.getValue(); if (v == null) continue; String subUri = ((Resource) sub).getURI(); if (!individualsMap.containsKey(subUri)) { com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri); individualsMap.put(subUri, new IndividualJena(ind, getWebappDaoFactory())); } } stmts = getOntModel().listStatements((Resource) null, prop, litv3); while (stmts.hasNext()) { count++; Statement stmt = stmts.nextStatement(); RDFNode sub = stmt.getSubject(); if (sub == null || sub.isAnon() || sub.isLiteral()) continue; RDFNode obj = stmt.getObject(); if (obj == null || !obj.isLiteral()) continue; Literal literal = (Literal) obj; Object v = literal.getValue(); if (v == null) continue; String subUri = ((Resource) sub).getURI(); if (!individualsMap.containsKey(subUri)) { com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri); individualsMap.put(subUri, new IndividualJena(ind, getWebappDaoFactory())); } } } finally { getOntModel().leaveCriticalSection(); } List<Individual> rv = new ArrayList<Individual>(individualsMap.size()); rv.addAll(individualsMap.values()); return rv; }
From source file:com.searchtechnologies.aspire.components.heritrixconnector.HeritrixScanner.java
/** * Find all URLs that were not accessed and evaluate which ones should be deleted * @param info /*ww w . j av a2 s . com*/ * @param job * @throws AspireException * @throws IOException */ private void deleteAfterCrawl(HeritrixSourceInfo info) throws AspireException, IOException { if (info.getTempUncrawledDB() == null) { info.setTempUncrawledDB(info.openTempDB()); } info.getTempUncrawledDB().clear(); info.commitUrlDB(); if (HeritrixSourceInfo.INITIAL_CRAWL_COMPLETE .equals(info.getIncrementalDB().get("||status||").split(",")[0])) { /* Contains the all the Entries on the database */ Iterator<Entry<String, String>> iter = info.getIncrementalDB().entrySet().iterator(); //Writes uncrawled urls to files by its host name HashMap<String, BufferedWriter> files = new HashMap<String, BufferedWriter>(); long commitDB = 0; // Scan through ALL URLs inside of JDBM2 (SCAN_UNCRAWLED LOOP) while (iter.hasNext() && info.getStatus() != HeritrixSourceInfo.SCAN_STOPPED) { Entry<String, String> entry = iter.next(); String url = entry.getKey(); String data = entry.getValue(); DataBaseURLEntry value = null; if (!"||status||".equals(url)) { if (data != null) value = DataBaseURLEntry.createDataBaseURLEntryFromString(data); long diff = info.getStartCrawlTime().getTime() - value.getLastAccessedTime().getTime(); /* We only need those that were not accessed on the actual crawl */ if (value != null && diff > 0) { if (url != null && info.getTempUncrawledDB().get(url) == null) { info.getTempUncrawledDB().put(url, data); commitDB++; if (commitDB % 25 == 0) { info.commitUrlDB(); } //Add it to the respective hostname file String hostname = new URL(StringUtilities.safeUrl(url)).getHost(); if (!files.containsKey(hostname)) { File file = new File(info.getUrlDir() + "/urlsToDelete_" + hostname + ".urls"); file.getParentFile().mkdirs(); if (file.exists()) { file.delete(); } files.put(hostname, new BufferedWriter(new FileWriter(file))); } files.get(hostname).write(url + " " + entry.getValue() + "\n"); } } } if (info.getStatus() == HeritrixSourceInfo.SCAN_PAUSED) { info.commitUrlDB(); } while (info.getStatus() == HeritrixSourceInfo.SCAN_PAUSED) ; } info.getIncrementalDB().put("||status||", HeritrixSourceInfo.TEMP_UNCRAWLED_DB_CREATED + "," + info.getStartCrawlTime().getTime()); info.commitUrlDB(); for (BufferedWriter bw : files.values()) { bw.flush(); bw.close(); } //Fill the hashmap of hostnames-Status try { for (String hostname : files.keySet()) scanUncrawledUrls(info, hostname); } catch (IOException ioe) { error(ioe, "Error scanning uncrawled urls file"); info.setScannerErrorMessage(ioe, "Error scanning uncrawled urls file"); throw new AspireException( "com.searchtechnologies.aspire.components.heritrixconnector.HeritrixScanner", ioe, "Error scanning uncrawled urls file"); } info.getPriorityQueueChecker().start(info.getScanJob(), this); long lastChange = new Date().getTime(); int lastCount = info.getTempUncrawledDB().size(); while (info.getPriorityQueueChecker().isRunning()) { try { Thread.sleep(500); if (new Date().getTime() - lastChange >= 2000) { try { for (String hostname : files.keySet()) scanUncrawledUrls(info, hostname); } catch (IOException ioe) { error(ioe, "Error scanning uncrawled urls file"); info.setScannerErrorMessage(ioe, "Error scanning uncrawled urls file"); throw new AspireException( "com.searchtechnologies.aspire.components.heritrixconnector.HeritrixScanner", ioe, "Error scanning uncrawled urls file"); } } if (lastCount != info.getTempUncrawledDB().size()) { lastChange = new Date().getTime(); } } catch (InterruptedException e) { } } } if (info.getStatus() == HeritrixSourceInfo.SCAN_PAUSED) { info.commitUrlDB(); } else if (info.getStatus() == HeritrixSourceInfo.SCAN_STOPPED) { info.getTempUncrawledDB().clear(); info.commitUrlDB(); } else if (HeritrixSourceInfo.TEMP_UNCRAWLED_DB_CREATED .equals(info.getIncrementalDB().get("||status||").split(",")[0])) { info.commitUrlDB(); } }
From source file:net.peterkuterna.android.apps.devoxxsched.io.RemoteScheduleHandler.java
@Override public ArrayList<ContentProviderOperation> parse(ArrayList<JSONArray> entries, ContentResolver resolver) throws JSONException { final ArrayList<ContentProviderOperation> batch = Lists.newArrayList(); final HashMap<String, ContentProviderOperation> blockBatchMap = Maps.newHashMap(); final HashMap<String, ContentProviderOperation> sessionUpdateBatchMap = Maps.newHashMap(); int nrEntries = 0; for (JSONArray schedules : entries) { Log.d(TAG, "Retrieved " + schedules.length() + " schedule entries."); nrEntries += schedules.length(); for (int i = 0; i < schedules.length(); i++) { JSONObject schedule = schedules.getJSONObject(i); final long startTime = ParserUtils.parseDevoxxTime(schedule.getString("fromTime")); final long endTime = ParserUtils.parseDevoxxTime(schedule.getString("toTime")); final String kind = schedule.getString("kind"); final String blockId = Blocks.generateBlockId(kind, startTime, endTime); if (!blockBatchMap.containsKey(blockId)) { final Uri blockUri = Blocks.buildBlockUri(blockId); ContentProviderOperation.Builder builder; if (isRowExisting(Blocks.buildBlockUri(blockId), BlocksQuery.PROJECTION, resolver)) { builder = ContentProviderOperation.newUpdate(blockUri); } else { builder = ContentProviderOperation.newInsert(Blocks.CONTENT_URI); builder.withValue(Blocks.BLOCK_ID, blockId); }//from ww w .ja va2 s . c o m builder.withValue(Blocks.BLOCK_START, startTime); builder.withValue(Blocks.BLOCK_END, endTime); final String type = schedule.getString("type"); final String code = schedule.getString("code"); if (code.startsWith("D10")) { builder.withValue(Blocks.BLOCK_TITLE, type.replaceAll("\\ \\(.*\\)", "")); } else { builder.withValue(Blocks.BLOCK_TITLE, schedule.getString("code")); } builder.withValue(Blocks.BLOCK_TYPE, kind); blockBatchMap.put(blockId, builder.build()); } if (schedule.has("presentationUri")) { final Uri presentationUri = Uri.parse(schedule.getString("presentationUri")); final String sessionId = presentationUri.getLastPathSegment(); final Uri sessionUri = Sessions.buildSessionUri(sessionId); if (isRowExisting(sessionUri, SessionsQuery.PROJECTION, resolver)) { String roomId = null; if (schedule.has("room")) { final String roomName = schedule.getString("room"); Cursor cursor = resolver.query(Rooms.buildRoomsWithNameUri(roomName), RoomsQuery.PROJECTION, null, null, null); if (cursor.moveToNext()) { roomId = cursor.getString(RoomsQuery.ROOM_ID); } cursor.close(); } final ContentProviderOperation.Builder builder = ContentProviderOperation .newUpdate(sessionUri); builder.withValue(Sessions.BLOCK_ID, blockId); builder.withValue(Sessions.ROOM_ID, roomId); if (schedule.has("note")) { final String note = schedule.getString("note"); if (note != null && note.trim().length() > 0) { builder.withValue(Sessions.NOTE, note.trim()); } } sessionUpdateBatchMap.put(sessionId, builder.build()); } } } } batch.addAll(blockBatchMap.values()); batch.addAll(sessionUpdateBatchMap.values()); if (isRemoteSync() && nrEntries > 0) { for (String lostId : getLostIds(blockBatchMap.keySet(), Blocks.CONTENT_URI, BlocksQuery.PROJECTION, BlocksQuery.BLOCK_ID, resolver)) { if (!lostId.startsWith("lab")) { final Uri lostBlockUri = Blocks.buildBlockUri(lostId); batch.add(ContentProviderOperation.newDelete(lostBlockUri).build()); } } for (String lostId : getLostIds(sessionUpdateBatchMap.keySet(), Sessions.CONTENT_URI, SessionsQuery.PROJECTION, SessionsQuery.SESSION_ID, resolver)) { Uri deleteUri = Sessions.buildSpeakersDirUri(lostId); batch.add(ContentProviderOperation.newDelete(deleteUri).build()); deleteUri = Sessions.buildTagsDirUri(lostId); batch.add(ContentProviderOperation.newDelete(deleteUri).build()); deleteUri = Sessions.buildSessionUri(lostId); batch.add(ContentProviderOperation.newDelete(deleteUri).build()); } } return batch; }
From source file:it.cnr.icar.eric.server.cache.ClassificationSchemeCache.java
/** * Clear all affectedObjects in AuditableEvent from cache. When called, * internalCache may be out of date with respect to dB (where transaction * has been committed) and objectCache (where affected classification nodes * have already been processed).<br> * This code keeps the cache primed if it was primed earlier. The side * effect of this choice is every other context (separate transaction) * immediately knows about the just-committed changes. That is, this cache * imitates TRANSACTION_READ_COMMITTED transaction isolation unless the * caching event setting is "never".//from www . j av a 2s . c o m */ public void onEvent(ServerRequestContext context, AuditableEventType ae) { final String eventType = ae.getEventType(); final boolean justRemove = primeCacheEvent.equalsIgnoreCase("never"); final boolean wasChanged = eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Created) || eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Updated) || eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Versioned); final boolean wasRemoved = eventType.equalsIgnoreCase(CanonicalConstants.CANONICAL_EVENT_TYPE_ID_Deleted); Set<String> schemesToRemove = new HashSet<String>(); HashMap<String, RegistryObjectType> schemesToUpdate = new HashMap<String, RegistryObjectType>(); primeCacheOnFirstUse(context); if (wasChanged || wasRemoved) { try { List<ObjectRefType> affectedObjects = ae.getAffectedObjects().getObjectRef(); Iterator<ObjectRefType> iter = affectedObjects.iterator(); while (iter.hasNext()) { ObjectRefType ref = iter.next(); String objectId = ref.getId(); RegistryObjectType ro = context.getAffectedObjectsMap().get(objectId); if (null == ro) { // In case missing (removed?) object was a scheme schemesToRemove.add(objectId); } else { if (ro instanceof ClassificationSchemeType) { if (wasRemoved || justRemove) { schemesToRemove.add(objectId); } else { schemesToUpdate.put(objectId, ro); } } else if (ro instanceof ClassificationNodeType) { String schemeId = bu.getSchemeIdForRegistryObject(ro); // Handle case where a node in a scheme has been // added, deleted or updated. if (justRemove) { schemesToRemove.add(schemeId); } else if (!(schemesToRemove.contains(schemeId) || schemesToUpdate.containsKey(schemeId))) { ClassificationSchemeType scheme = (ClassificationSchemeType) getRegistryObjectInternal( context, schemeId, "ClassScheme"); if (null != scheme) { schemesToUpdate.put(schemeId, scheme); // ??? Why is this necessary for all // ??? schemes loaded? loadChildren(context, scheme, getDepthForScheme(schemeId)); } } } } } } catch (JAXRException e) { log.error(e); // Just update all schemes to be safe in case of any errors reset(context); // Make following block a no-op. schemesToRemove.clear(); schemesToUpdate.clear(); } } synchronized (internalCache) { int oldSize; // xxx pa 110816 added try / catch for CacheException (ehcache 1.0 effect?) try { oldSize = internalCache.getSize(); Iterator<String> iter = schemesToRemove.iterator(); while (iter.hasNext()) { String objectId = iter.next(); internalCache.remove(objectId); } if (justRemove) { // Cache may become primed regardless of primeCacheEvent // setting, pay attention if we have undone that. if (oldSize != internalCache.getSize()) { cacheIsPrimed = false; } } else if (schemesToUpdate.size() > 0) { addClassificationSchemesToCache(schemesToUpdate.values()); } } catch (CacheException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:microsoft.exchange.webservices.data.core.ExchangeService.java
/** * Applies one time conversation action on item in specified folder inside * the conversation./*from w ww .j av a 2 s.c o m*/ * * @param actionType The action * @param idTimePairs The id time pairs. * @param contextFolderId The context folder id. * @param destinationFolderId The destination folder id. * @param deleteType Type of the delete. * @param isRead The is read. * @param errorHandlingMode The error handling mode. * @throws Exception */ private ServiceResponseCollection<ServiceResponse> applyConversationOneTimeAction( ConversationActionType actionType, Iterable<HashMap<ConversationId, Date>> idTimePairs, FolderId contextFolderId, FolderId destinationFolderId, DeleteMode deleteType, Boolean isRead, ServiceErrorHandling errorHandlingMode) throws Exception { EwsUtilities.ewsAssert( actionType == ConversationActionType.Move || actionType == ConversationActionType.Delete || actionType == ConversationActionType.SetReadState || actionType == ConversationActionType.Copy, "ApplyConversationOneTimeAction", "Invalid actionType"); EwsUtilities.validateParamCollection(idTimePairs.iterator(), "idTimePairs"); EwsUtilities.validateMethodVersion(this, ExchangeVersion.Exchange2010_SP1, "ApplyConversationAction"); ApplyConversationActionRequest request = new ApplyConversationActionRequest(this, errorHandlingMode); for (HashMap<ConversationId, Date> idTimePair : idTimePairs) { ConversationAction action = new ConversationAction(); action.setAction(actionType); action.setConversationId(idTimePair.keySet().iterator().next()); action.setContextFolderId(contextFolderId != null ? new FolderIdWrapper(contextFolderId) : null); action.setDestinationFolderId( destinationFolderId != null ? new FolderIdWrapper(destinationFolderId) : null); action.setConversationLastSyncTime(idTimePair.values().iterator().next()); action.setIsRead(isRead); action.setDeleteType(deleteType); request.getConversationActions().add(action); } return request.execute(); }
From source file:com.enonic.vertical.engine.handlers.MenuHandler.java
private void composeAdminMenu(Document doc, HashMap<Integer, Element> menuMap, HashMap<Integer, List<Element>> menuItemMap, String[] menuItemTypes, boolean includeReadOnlyAccessRight) { // Add menu elements Element root = doc.getDocumentElement(); for (Element element : menuMap.values()) { root.appendChild(element);//from w w w .jav a2s . c o m } // Add menu item elements for (Object o : menuItemMap.entrySet()) { Map.Entry entry = (Map.Entry) o; Integer menuKey = (Integer) entry.getKey(); List menuItems = (List) entry.getValue(); Element currentMenu = menuMap.get(menuKey); if (currentMenu != null) { for (Object menuItem : menuItems) { currentMenu.appendChild((Element) menuItem); } } } // Filter the menus Element[] menuElements = XMLTool.getElements(root); for (Element menuElement : menuElements) { filterAdminMenuItemElements(menuElement, menuItemTypes, includeReadOnlyAccessRight); } }
From source file:com.indeema.mail.ui.AbstractActivityController.java
private void handleDragFromStarred(Folder folder) { final Collection<Conversation> conversations = mSelectedSet.values(); // The conversation list deletes and performs the action if it exists. final ConversationListFragment convListFragment = getConversationListFragment(); // There should always be a convlistfragment, or the user could not have // dragged/ dropped conversations. if (convListFragment != null) { LogUtils.d(LOG_TAG, "AAC.requestDelete: ListFragment is handling delete."); ArrayList<ConversationCursor.ConversationOperation> ops = new ArrayList<ConversationCursor.ConversationOperation>(); ArrayList<Uri> folderUris; ArrayList<Boolean> adds; for (Conversation target : conversations) { folderUris = new ArrayList<Uri>(); adds = new ArrayList<Boolean>(); folderUris.add(folder.folderUri.fullUri); adds.add(Boolean.TRUE); final HashMap<Uri, Folder> targetFolders = Folder.hashMapForFolders(target.getRawFolders()); targetFolders.put(folder.folderUri.fullUri, folder); ops.add(mConversationListCursor.getConversationFolderOperation(target, folderUris, adds, targetFolders.values())); }/*from www. j a v a 2s.co m*/ if (mConversationListCursor != null) { mConversationListCursor.updateBulkValues(ops); } refreshConversationList(); mSelectedSet.clear(); } }
From source file:com.chen.mail.ui.AbstractActivityController.java
private void handleDragFromStarred(Folder folder) { final Collection<Conversation> conversations = mSelectedSet.values(); // The conversation list deletes and performs the action if it exists. final ConversationListFragment convListFragment = getConversationListFragment(); // There should always be a convlistfragment, or the user could not have // dragged/ dropped conversations. if (convListFragment != null) { LogUtils.d(LOG_TAG, "AAC.requestDelete: ListFragment is handling delete."); ArrayList<ConversationOperation> ops = new ArrayList<ConversationOperation>(); ArrayList<Uri> folderUris; ArrayList<Boolean> adds; for (Conversation target : conversations) { folderUris = new ArrayList<Uri>(); adds = new ArrayList<Boolean>(); folderUris.add(folder.folderUri.fullUri); adds.add(Boolean.TRUE); final HashMap<Uri, Folder> targetFolders = Folder.hashMapForFolders(target.getRawFolders()); targetFolders.put(folder.folderUri.fullUri, folder); ops.add(mConversationListCursor.getConversationFolderOperation(target, folderUris, adds, targetFolders.values())); }//from w w w .ja v a 2s. c o m if (mConversationListCursor != null) { mConversationListCursor.updateBulkValues(ops); } refreshConversationList(); mSelectedSet.clear(); } }
From source file:edu.umass.cs.gigapaxos.PaxosInstanceStateMachine.java
private MessagingTask handleSyncDecisionsPacket(SyncDecisionsPacket syncReply) throws JSONException { int minMissingSlot = syncReply.missingSlotNumbers.get(0); log.log(Level.FINE, "{0} handling sync decisions request {1} when maxCommittedSlot = {2}", new Object[] { this, syncReply.getSummary(), this.paxosState.getMaxCommittedSlot() }); if (this.paxosState.getMaxCommittedSlot() - minMissingSlot < 0) return null; // I am worse than you // get checkpoint if minMissingSlot > last checkpointed slot MessagingTask checkpoint = null;/* ww w . java 2s. c o m*/ if (minMissingSlot - lastCheckpointSlot(this.paxosState.getSlot(), syncReply.getPaxosID()) <= 0) { checkpoint = handleCheckpointRequest(syncReply); if (checkpoint != null) // only get decisions beyond checkpoint minMissingSlot = ((StatePacket) (checkpoint.msgs[0])).slotNumber + 1; } // try to get decisions from memory first HashMap<Integer, PValuePacket> missingDecisionsMap = new HashMap<Integer, PValuePacket>(); for (PValuePacket pvalue : this.paxosState.getCommitted(syncReply.missingSlotNumbers)) missingDecisionsMap.put(pvalue.slot, pvalue.setNoCoalesce()); // get decisions from database as unlikely to have all of them in memory ArrayList<PValuePacket> missingDecisions = this.paxosManager.getPaxosLogger().getLoggedDecisions( this.getPaxosID(), this.getVersion(), minMissingSlot, /* If maxDecision <= minMissingSlot, sender is probably * doing a creation sync. But we need min < max for the * database query to return nonzero results, so we * adjust up the max if needed. Note that * getMaxCommittedSlot() at this node may not be greater * than minMissingDecision either. For example, the * sender may be all caught up at slot 0 and request a * creation sync for 1 and this node may have committed * up to 1; if so, it should return decision 1. */ syncReply.maxDecisionSlot > minMissingSlot ? syncReply.maxDecisionSlot : Math.max(minMissingSlot + 1, this.paxosState.getMaxCommittedSlot() + 1)); // filter non-missing from database decisions if (syncReply.maxDecisionSlot > minMissingSlot) for (Iterator<PValuePacket> pvalueIterator = missingDecisions.iterator(); pvalueIterator.hasNext();) { PValuePacket pvalue = pvalueIterator.next(); if (!syncReply.missingSlotNumbers.contains(pvalue.slot)) pvalueIterator.remove(); // filter non-missing else pvalue.setNoCoalesce(); // send as-is, no compacting // isRecovery() true only in rollForward assert (!pvalue.isRecovery()); } // copy over database decisions not in memory for (PValuePacket pvalue : missingDecisions) if (!missingDecisionsMap.containsKey(pvalue.slot)) missingDecisionsMap.put(pvalue.slot, pvalue); // replace meta decisions with actual decisions getActualDecisions(missingDecisionsMap); assert (missingDecisionsMap.isEmpty() || missingDecisionsMap.values().toArray(new PaxosPacket[0]).length > 0) : missingDecisions; for (PValuePacket pvalue : missingDecisionsMap.values()) { pvalue.setNoCoalesce(); assert (pvalue.hasRequestValue()); } // the list of missing decisions to be sent MessagingTask unicasts = missingDecisionsMap.isEmpty() ? null : new MessagingTask(syncReply.nodeID, (missingDecisionsMap.values().toArray(new PaxosPacket[0]))); log.log(Level.INFO, "{0} sending {1} missing decision(s) to node {2} in response to {3}", new Object[] { this, unicasts == null ? 0 : unicasts.msgs.length, syncReply.nodeID, syncReply.getSummary() }); if (checkpoint != null) log.log(Level.INFO, "{0} sending checkpoint for slot {1} to node {2} in response to {3}", new Object[] { this, minMissingSlot - 1, syncReply.nodeID, syncReply.getSummary() }); // combine checkpoint and missing decisions in unicasts MessagingTask mtask = // both nonempty => combine (checkpoint != null && unicasts != null && !checkpoint.isEmpty() && !unicasts.isEmpty()) ? mtask = new MessagingTask(syncReply.nodeID, MessagingTask.toPaxosPacketArray(checkpoint.msgs, unicasts.msgs)) : // nonempty checkpoint (checkpoint != null && !checkpoint.isEmpty()) ? checkpoint : // unicasts (possibly also empty or null) unicasts; log.log(Level.FINE, "{0} sending mtask: ", new Object[] { this, mtask }); return mtask; }