Java 类org.apache.zookeeper.KeeperException.SessionExpiredException 实例源码

项目:https-github.com-apache-zookeeper    文件:SessionTrackerImpl.java   
public synchronized void checkSession(long sessionId, Object owner)
        throws KeeperException.SessionExpiredException,
        KeeperException.SessionMovedException,
        KeeperException.UnknownSessionException {
    LOG.debug("Checking session 0x" + Long.toHexString(sessionId));
    SessionImpl session = sessionsById.get(sessionId);

    if (session == null) {
        throw new KeeperException.UnknownSessionException();
    }

    if (session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }

    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:https-github.com-apache-zookeeper    文件:LearnerSessionTracker.java   
public void checkSession(long sessionId, Object owner)
        throws SessionExpiredException, SessionMovedException  {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.checkSession(sessionId, owner);
            return;
        } catch (UnknownSessionException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw new SessionExpiredException();
            }
        }
    }
}
项目:https-github.com-apache-zookeeper    文件:LearnerSessionTracker.java   
public void setOwner(long sessionId, Object owner)
        throws SessionExpiredException {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.setOwner(sessionId, owner);
            return;
        } catch (SessionExpiredException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw e;
            }
        }
    }
}
项目:incubator-pulsar    文件:DiscoveryServiceTest.java   
@Test
public void testGetPartitionsMetadata() throws Exception {
    DestinationName topic1 = DestinationName.get("persistent://test/local/ns/my-topic-1");

    PartitionedTopicMetadata m = service.getDiscoveryProvider().getPartitionedTopicMetadata(service, topic1, "role")
            .get();
    assertEquals(m.partitions, 0);

    // Simulate ZK error
    mockZookKeeper.failNow(Code.SESSIONEXPIRED);
    DestinationName topic2 = DestinationName.get("persistent://test/local/ns/my-topic-2");
    CompletableFuture<PartitionedTopicMetadata> future = service.getDiscoveryProvider()
            .getPartitionedTopicMetadata(service, topic2, "role");
    try {
        future.get();
        fail("Partition metadata lookup should have failed");
    } catch (ExecutionException e) {
        assertEquals(e.getCause().getClass(), SessionExpiredException.class);
    }
}
项目:SecureKeeper    文件:SessionTrackerImpl.java   
public synchronized void checkSession(long sessionId, Object owner)
        throws KeeperException.SessionExpiredException,
        KeeperException.SessionMovedException,
        KeeperException.UnknownSessionException {
    LOG.debug("Checking session 0x" + Long.toHexString(sessionId));
    SessionImpl session = sessionsById.get(sessionId);

    if (session == null) {
        throw new KeeperException.UnknownSessionException();
    }

    if (session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }

    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:SecureKeeper    文件:LearnerSessionTracker.java   
public void checkSession(long sessionId, Object owner)
        throws SessionExpiredException, SessionMovedException  {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.checkSession(sessionId, owner);
            return;
        } catch (UnknownSessionException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw new SessionExpiredException();
            }
        }
    }
}
项目:SecureKeeper    文件:LearnerSessionTracker.java   
public void setOwner(long sessionId, Object owner)
        throws SessionExpiredException {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.setOwner(sessionId, owner);
            return;
        } catch (SessionExpiredException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw e;
            }
        }
    }
}
项目:SecureKeeper    文件:SessionTrackerImpl.java   
public synchronized void checkSession(long sessionId, Object owner)
        throws KeeperException.SessionExpiredException,
        KeeperException.SessionMovedException,
        KeeperException.UnknownSessionException {
    LOG.debug("Checking session 0x" + Long.toHexString(sessionId));
    SessionImpl session = sessionsById.get(sessionId);

    if (session == null) {
        throw new KeeperException.UnknownSessionException();
    }

    if (session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }

    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:SecureKeeper    文件:LearnerSessionTracker.java   
public void checkSession(long sessionId, Object owner)
        throws SessionExpiredException, SessionMovedException  {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.checkSession(sessionId, owner);
            return;
        } catch (UnknownSessionException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw new SessionExpiredException();
            }
        }
    }
}
项目:SecureKeeper    文件:LearnerSessionTracker.java   
public void setOwner(long sessionId, Object owner)
        throws SessionExpiredException {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.setOwner(sessionId, owner);
            return;
        } catch (SessionExpiredException e) {
            // Check whether it's a global session. We can ignore those
            // because they are handled at the leader, but if not, rethrow.
            // We check local session status first to avoid race condition
            // with session upgrading.
            if (!isGlobalSession(sessionId)) {
                throw e;
            }
        }
    }
}
项目:fuck_zookeeper    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:fuck_zookeeper    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:fuck_zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:https-github.com-apache-zookeeper    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:https-github.com-apache-zookeeper    文件:SessionTrackerImpl.java   
public void checkGlobalSession(long sessionId, Object owner)
        throws KeeperException.SessionExpiredException,
        KeeperException.SessionMovedException {
    try {
        checkSession(sessionId, owner);
    } catch (KeeperException.UnknownSessionException e) {
        throw new KeeperException.SessionExpiredException();
    }
}
项目:https-github.com-apache-zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:https-github.com-apache-zookeeper    文件:LeaderSessionTracker.java   
public void checkGlobalSession(long sessionId, Object owner)
        throws SessionExpiredException, SessionMovedException {
    try {
        globalSessionTracker.checkSession(sessionId, owner);
    } catch (UnknownSessionException e) {
        // For global session, if we don't know it, it is already expired
        throw new SessionExpiredException();
    }
}
项目:https-github.com-apache-zookeeper    文件:LeaderSessionTracker.java   
public void setOwner(long sessionId, Object owner)
        throws SessionExpiredException {
    if (localSessionTracker != null) {
        try {
            localSessionTracker.setOwner(sessionId, owner);
            return;
        } catch(SessionExpiredException e) {
            // Ignore. We'll check instead whether it's a global session
        }
    }
    globalSessionTracker.setOwner(sessionId, owner);
}
项目:ZooKeeper    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:ZooKeeper    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:ZooKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:ditb    文件:HBaseReplicationEndpoint.java   
/**
 * A private method used to re-establish a zookeeper session with a peer cluster.
 * @param ke
 */
protected void reconnect(KeeperException ke) {
  if (ke instanceof ConnectionLossException || ke instanceof SessionExpiredException
      || ke instanceof AuthFailedException) {
    String clusterKey = ctx.getPeerConfig().getClusterKey();
    LOG.warn("Lost the ZooKeeper connection for peer " + clusterKey, ke);
    try {
      reloadZkWatcher();
    } catch (IOException io) {
      LOG.warn("Creation of ZookeeperWatcher failed for peer " + clusterKey, io);
    }
  }
}
项目:StreamProcessingInfrastructure    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:StreamProcessingInfrastructure    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:StreamProcessingInfrastructure    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:bigstreams    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:bigstreams    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:bigstreams    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:bigstreams    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:bigstreams    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:bigstreams    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:zookeeper-src-learning    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:zookeeper-src-learning    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:zookeeper-src-learning    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:zookeeper    文件:SessionTrackerImpl.java   
synchronized public void checkSession(long sessionId, Object owner) throws KeeperException.SessionExpiredException, KeeperException.SessionMovedException {
    SessionImpl session = sessionsById.get(sessionId);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    if (session.owner == null) {
        session.owner = owner;
    } else if (session.owner != owner) {
        throw new KeeperException.SessionMovedException();
    }
}
项目:zookeeper    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}
项目:SecureKeeper    文件:SessionTrackerImpl.java   
synchronized public void setOwner(long id, Object owner) throws SessionExpiredException {
    SessionImpl session = sessionsById.get(id);
    if (session == null || session.isClosing()) {
        throw new KeeperException.SessionExpiredException();
    }
    session.owner = owner;
}
项目:SecureKeeper    文件:SessionTrackerImpl.java   
public void checkGlobalSession(long sessionId, Object owner)
        throws KeeperException.SessionExpiredException,
        KeeperException.SessionMovedException {
    try {
        checkSession(sessionId, owner);
    } catch (KeeperException.UnknownSessionException e) {
        throw new KeeperException.SessionExpiredException();
    }
}
项目:SecureKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void revalidateSession(ServerCnxn cnxn, long sessionId,
    int sessionTimeout) throws IOException {
    super.revalidateSession(cnxn, sessionId, sessionTimeout);
    try {
        // setowner as the leader itself, unless updated
        // via the follower handlers
        setOwner(sessionId, ServerCnxn.me);
    } catch (SessionExpiredException e) {
        // this is ok, it just means that the session revalidation failed.
    }
}