if(notification.getParcelId() == null) { obtainCommonNotification(notification); } else { Object item_x = checkItemInternal(notification.getItemId()); NodeInfo from = notification.getFrom(); ItemResult r = (ItemResult) item_x; if (notification.answerIsRequested()) { network.deliver( from, new ParcelNotification(myInfo, notification.getItemId(), notification.getParcelId(), r, false, notification.getType()) ); Object x = checkParcelInternal(notification.getParcelId(), null, true); NodeInfo from = notification.getFrom(); ItemResult resultVote = notification.getItemResult(); pp.lock(() -> { pp.vote(from, resultVote.state, notification.getType().isU()); else log.e("pending vote on parcel " + notification.getParcelId()
public static void init() { registerClass(CODE_PARCEL_NOTIFICATION, ParcelNotification.class); }
@Override public String toString() { return "[ParcelNotification from: " + getFrom() + " for parcel: " + parcelId + " and item: " + getItemId() + ", type is: " + type + ", is answer requested: " + answerIsRequested() + "]"; }
if(notification instanceof ParcelNotification && ((ParcelNotification)notification).getParcelId() != null) { report(getLabel(), () -> concatReportMessage( from.getNumber(), finalTo.getNumber(), " PN ", ((ParcelNotification)notification).getParcelId().toString()," ", ((ParcelNotification)notification).getType() == null ? "NULL" : ((ParcelNotification)notification).getType().name()), DatagramAdapter.VerboseLevel.DETAILED); } else if(notification instanceof ItemNotification) {
notType = ((ParcelNotification)notification).getType(); } else { notType = ParcelNotification.ParcelNotificationType.PAYMENT; network.deliver( from, new ParcelNotification(myInfo, notification.getItemId(), null, network.deliver( from, new ParcelNotification(myInfo, notification.getItemId(), null,
private final void sendStartPollingNotification() { if(processingState.canContinue()) { if (!processingState.isProcessedToConsensus()) { synchronized (mutex) { if (isPollingExpired()) { // cancel by timeout expired processingState = ItemProcessingState.GOT_CONSENSUS; stopPoller(); stopDownloader(); rollbackChanges(ItemState.UNDEFINED); return; } } // at this point we should requery the nodes that did not yet answered us Notification notification; ParcelNotification.ParcelNotificationType notificationType; if(item.shouldBeU()) { notificationType = ParcelNotification.ParcelNotificationType.PAYMENT; } else { notificationType = ParcelNotification.ParcelNotificationType.PAYLOAD; } notification = new ParcelNotification(myInfo, itemId, parcelId, getResult(), true, notificationType); List<NodeInfo> nodes = network.allNodes(); for(NodeInfo node : nodes) { if (!positiveNodes.contains(node) && !negativeNodes.contains(node)) network.deliver(node, notification); } } } }
private final void broadcastMyState() { report(getLabel(), () -> concatReportMessage("item processor for item: ", itemId, " from parcel: ", parcelId, " :: broadcastMyState, state ", processingState, " itemState: ", getState()), DatagramAdapter.VerboseLevel.BASE); if(processingState.canContinue()) { Notification notification; ParcelNotification.ParcelNotificationType notificationType; if(item.shouldBeU()) { notificationType = ParcelNotification.ParcelNotificationType.PAYMENT; } else { notificationType = ParcelNotification.ParcelNotificationType.PAYLOAD; } notification = new ParcelNotification(myInfo, itemId, parcelId, getResult(), true, notificationType); network.broadcast(myInfo, notification); } }
notificationType = ParcelNotification.ParcelNotificationType.PAYLOAD; notification = new ParcelNotification(myInfo, itemId, parcelId, getResult(), true, notificationType); List<NodeInfo> nodes = network.allNodes(); for(NodeInfo node : nodes) {