Package com.esotericsoftware.kryonet

Examples of com.esotericsoftware.kryonet.KryoNetException


          return next(partial);
        }
        total += count;
      }
    } catch (IOException ex) {
      throw new KryoNetException(ex);
    }
    return next(chunk);
  }
View Full Code Here


      result = cachedMethod.invoke(target, invokeMethod.args);
    } catch (InvocationTargetException ex) {
      if (transmitExceptions)
        result = ex.getCause();
      else
        throw new KryoNetException("Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "."
          + cachedMethod.method.getName(), ex);
    } catch (Exception ex) {
      throw new KryoNetException("Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "."
        + cachedMethod.method.getName(), ex);
    }

    if (responseID == 0) return;
View Full Code Here

          return waitForResponse((Byte)args[0]);
        } else if (name.equals("getConnection")) {
          return connection;
        }
        // Should never happen, for debugging purposes only
        throw new KryoNetException("Invocation handler could not find RemoteObject method. Check ObjectSpace.java");
      } else if (!remoteToString && declaringClass == Object.class && method.getName().equals("toString")) //
        return "<proxy>";

      InvokeMethod invokeMethod = new InvokeMethod();
      invokeMethod.objectID = objectID;
      invokeMethod.args = args;

      CachedMethod[] cachedMethods = getMethods(connection.getEndPoint().getKryo(), method.getDeclaringClass());
      for (int i = 0, n = cachedMethods.length; i < n; i++) {
        CachedMethod cachedMethod = cachedMethods[i];
        if (cachedMethod.method.equals(method)) {
          invokeMethod.cachedMethod = cachedMethod;
          break;
        }
      }
      if (invokeMethod.cachedMethod == null) throw new KryoNetException("Method not found: " + method);

      // A invocation doesn't need a response if it's async and no return values or exceptions are wanted back.
      boolean needsResponse = !udp && (transmitReturnValue || transmitExceptions || !nonBlocking);
      byte responseID = 0;
      if (needsResponse) {
View Full Code Here

          lock.lock();
          try {
            responseCondition.await(remaining, TimeUnit.MILLISECONDS);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new KryoNetException(e);
          } finally {
            lock.unlock();
          }
        }
      }
View Full Code Here

   * @author Nathan Sweet <misc@n4te.com> */
  static public class RemoteObjectSerializer extends Serializer {
    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);
    }
View Full Code Here

      // Catch exceptions caused by the Method#invoke
    } catch (InvocationTargetException ex) {
      if (transmitExceptions)
        result = ex.getCause();
      else
        throw new KryoNetException("Error invoking method: " + method.getDeclaringClass().getName() + "." + method.getName(),
          ex);
    } catch (Exception ex) {
      throw new KryoNetException("Error invoking method: " + method.getDeclaringClass().getName() + "." + method.getName(), ex);
    }

    if (responseID == 0) return;

    InvokeMethodResult invokeMethodResult = new InvokeMethodResult();
View Full Code Here

          return waitForResponse((Byte)args[0]);
        } else if (name.equals("getConnection")) {
          return connection;
        }
        // Should never happen, for debugging purposes only
        throw new KryoNetException("Invocation handler could not find RemoteObject method. Check ObjectSpace.java");
      } else if (!remoteToString && declaringClass == Object.class && method.getName().equals("toString")) //
        return "<proxy>";

      InvokeMethod invokeMethod = new InvokeMethod();
      invokeMethod.objectID = objectID;
View Full Code Here

          lock.lock();
          try {
            responseCondition.await(remaining, TimeUnit.MILLISECONDS);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new KryoNetException(e);
          } finally {
            lock.unlock();
          }
        }
      }
View Full Code Here

   * @author Nathan Sweet <misc@n4te.com> */
  static public class RemoteObjectSerializer extends Serializer {
    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);
    }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryonet.KryoNetException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.