Java 类com.esotericsoftware.kryonet.KryoNetException 实例源码

项目:EsperDist    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:EsperDist    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:magic-realm    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:kingdom    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:the-erder    文件:InputStreamSender.java   
protected final Object next() {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0)
                    return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:kryonet    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return next(partial);
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:RuinsOfRevenge    文件:InputStreamSender.java   
protected final Object next () {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0) return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return partial;
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
项目:magic-realm    文件:ObjectSpace.java   
private Object waitForResponse (byte responseID) {
    if (connection.getEndPoint().getUpdateThread() == Thread.currentThread())
        throw new IllegalStateException("Cannot wait for an RMI response on the connection's update thread.");

    long endTime = System.currentTimeMillis() + timeoutMillis;

    while (true) {
        long remaining = endTime - System.currentTimeMillis();
        InvokeMethodResult invokeMethodResult;
        synchronized (this) {
            invokeMethodResult = responseTable[responseID];
        }
        if (invokeMethodResult != null) {
            lastResponseID = null;
            return invokeMethodResult.result;
        } else {
            if (remaining <= 0) throw new TimeoutException("Response timed out.");

            lock.lock();
            try {
                responseCondition.await(remaining, TimeUnit.MILLISECONDS);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new KryoNetException(e);
            } finally {
                lock.unlock();
            }
        }
    }
}
项目:the-erder    文件:ObjectSpace.java   
private Object waitForResponse(byte responseID) {
    if (connection.getEndPoint().getUpdateThread() == Thread
            .currentThread())
        throw new IllegalStateException(
                "Cannot wait for an RMI response on the connection's update thread.");

    long endTime = System.currentTimeMillis() + timeoutMillis;

    while (true) {
        long remaining = endTime - System.currentTimeMillis();
        if (responseTable.containsKey(responseID)) {
            InvokeMethodResult invokeMethodResult = responseTable
                    .get(responseID);
            responseTable.remove(responseID);
            lastResponseID = null;
            return invokeMethodResult.result;
        } else {
            if (remaining <= 0)
                throw new TimeoutException("Response timed out.");

            lock.lock();
            try {
                responseCondition.await(remaining,
                        TimeUnit.MILLISECONDS);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new KryoNetException(e);
            } finally {
                lock.unlock();
            }
        }
    }
}
项目:the-erder    文件:ObjectSpace.java   
@SuppressWarnings("unchecked")
      public void write(Kryo kryo, Output output, Object object) {
    Connection connection = (Connection) kryo.getContext().get(
            "connection");
    int id = getRegisteredID(connection, object);
    if (id == Integer.MAX_VALUE)
        throw new KryoNetException(
                "Object not found in an ObjectSpace: " + object);
    output.writeInt(id, true);
}
项目:kryonet    文件:ObjectSpace.java   
private Object waitForResponse (byte responseID) {
    if (connection.getEndPoint().getUpdateThread() == Thread.currentThread())
        throw new IllegalStateException("Cannot wait for an RMI response on the connection's update thread.");

    long endTime = System.currentTimeMillis() + timeoutMillis;

    while (true) {
        long remaining = endTime - System.currentTimeMillis();
        InvokeMethodResult invokeMethodResult;
        synchronized (this) {
            invokeMethodResult = responseTable[responseID];
        }
        if (invokeMethodResult != null) {
            lastResponseID = null;
            return invokeMethodResult.result;
        } else {
            if (remaining <= 0) throw new TimeoutException("Response timed out.");

            lock.lock();
            try {
                responseCondition.await(remaining, TimeUnit.MILLISECONDS);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new KryoNetException(e);
            } finally {
                lock.unlock();
            }
        }
    }
}
项目:magic-realm    文件:ObjectSpace.java   
public void write (Kryo kryo, Output output, Object object) {
    Connection connection = (Connection)kryo.getContext().get("connection");
    int id = getRegisteredID(connection, object);
    if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object);
    output.writeInt(id, true);
}
项目:kryonet    文件:ObjectSpace.java   
public void write (Kryo kryo, Output output, Object object) {
    Connection connection = (Connection)kryo.getContext().get("connection");
    int id = getRegisteredID(connection, object);
    if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object);
    output.writeInt(id, true);
}