/** * Creates a new view * * @param creator The creator of this view (can not be null) * @param id The lamport timestamp of this view * @param members Contains a list of all the members in the view, can be empty but not null. */ public View(Address creator, long id, List<Address> members) { this(new ViewId(creator, id), members); }
public ViewId copy() { return new ViewId(creator, id); }
public static View create(Address coord, long id, Address ... members) { return new View(new ViewId(coord, id), members); }
public static View create(Address coord, long id, Collection<Address> members) { return new View(new ViewId(coord, id), members); }
public void stop() { synchronized (sharedLock) { currentView = new View(new ViewId(), new ArrayList<>()); flushCompletedMap.clear(); flushNotCompletedMap.clear(); flushMembers.clear(); suspected.clear(); flushCoordinator = null; } }
public static ViewId readViewId(DataInput in) throws Exception { if(!in.readBoolean()) return null; ViewId retval=new ViewId(); retval.readFrom(in); return retval; }
@SuppressWarnings("unchecked") public void readFrom(DataInput in) throws Exception { view_id=new ViewId(); view_id.readFrom(in); members=Util.readAddresses(in); }
@Override public void installView(NetView v) { this.view = v; if (this.jgAddress.getVmViewId() < 0) { this.jgAddress.setVmViewId(this.localAddress.getVmViewId()); } List<JGAddress> mbrs = new ArrayList<>(v.size()); mbrs.addAll(v.getMembers().stream().map(JGAddress::new).collect(Collectors.toList())); ViewId vid = new ViewId(new JGAddress(v.getCoordinator()), v.getViewId()); View jgv = new View(vid, new ArrayList<>(mbrs)); logger.trace("installing view into JGroups stack: {}", jgv); this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv)); addressesWithIoExceptionsProcessed.clear(); if (encrypt != null) { encrypt.installView(v); } synchronized (scheduledMcastSeqnos) { for (DistributedMember mbr : v.getCrashedMembers()) { scheduledMcastSeqnos.remove(mbr); } for (DistributedMember mbr : v.getShutdownMembers()) { scheduledMcastSeqnos.remove(mbr); } } }
ViewId vid = new ViewId(new JGAddress(), 0); List<Address> members = new ArrayList<>(); members.add(new UUID(0, 0));// TODO open a JGroups JIRA for GEODE-3034
/** * Drops messages to/from other members and then closes the channel. Note that this member won't get excluded from * the view until failure detection has kicked in and the new coord installed the new view */ public static void shutdown(JChannel ch) throws Exception { DISCARD discard=new DISCARD(); discard.setLocalAddress(ch.getAddress()); discard.setDiscardAll(true); ProtocolStack stack=ch.getProtocolStack(); TP transport=stack.getTransport(); stack.insertProtocol(discard,ProtocolStack.Position.ABOVE,transport.getClass()); //abruptly shutdown FD_SOCK just as in real life when member gets killed non gracefully FD_SOCK fd=ch.getProtocolStack().findProtocol(FD_SOCK.class); if(fd != null) fd.stopServerSocket(false); View view=ch.getView(); if(view != null) { ViewId vid=view.getViewId(); List<Address> members=Collections.singletonList(ch.getAddress()); ViewId new_vid=new ViewId(ch.getAddress(),vid.getId() + 1); View new_view=new View(new_vid,members); // inject view in which the shut down member is the only element GMS gms=stack.findProtocol(GMS.class); gms.installView(new_view); } Util.close(ch); }
/** * Creates a new view * * @param creator The creator of this view (can not be null) * @param id The lamport timestamp of this view * @param members Contains a list of all the members in the view, can be empty but not null. */ public View(Address creator, long id, List<Address> members) { this(new ViewId(creator, id), members); }
/** * Creates a new view * * @param creator The creator of this view (can not be null) * @param id The lamport timestamp of this view * @param members Contains a list of all the members in the view, can be empty but not null. */ public View(Address creator, long id, Vector<Address> members) { this(new ViewId(creator, id), members); }
/** * Generates a unique merge id by taking the local address and the current time */ private ViewId generateMergeId() { return new ViewId(gms.local_addr, System.currentTimeMillis()); // we're (ab)using ViewId as a merge id }
public void stop() { synchronized (sharedLock) { currentView = new View(new ViewId(), new ArrayList<>()); flushCompletedMap.clear(); flushNotCompletedMap.clear(); flushMembers.clear(); suspected.clear(); flushCoordinator = null; } }
public FLUSH() { super(); currentView = new View(new ViewId(), new Vector<Address>()); flushOkSet = new TreeSet<Address>(); flushCompletedMap = new HashMap<Address, Digest>(); stopFlushOkSet = new TreeSet<Address>(); flushMembers = new ArrayList<Address>(); suspected = new TreeSet<Address>(); }
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException { newViewId=new ViewId(); newViewId.readFrom(in); localTime=in.readInt(); complete=in.readBoolean(); }
public static ViewId readViewId(DataInput in) throws Exception { if(!in.readBoolean()) return null; ViewId retval=new ViewId(); retval.readFrom(in); return retval; }
@SuppressWarnings("unchecked") public void readFrom(DataInput in) throws Exception { view_id=new ViewId(); view_id.readFrom(in); members=Util.readAddresses(in); }