37 Commits

Author SHA1 Message Date
Paul Speed
14e84a4dd7 Added a constructor that just takes the service's
default channel.
2015-12-05 04:15:48 -05:00
Paul Speed
99742a76f2 Added additional trace logging. 2015-12-05 04:15:28 -05:00
Paul Speed
15afcfb735 Added the error information to the toString() if
there is error information to show.
2015-12-05 04:05:49 -05:00
Paul Speed
197ed33c9e Added some missing @Overrides and finals. 2015-11-22 05:23:24 -05:00
Paul Speed
388a8a8bd7 Added a bunch of lower level logging that can be
used to either watch traffic or debug serialization
issues, etc..
Went ahead and instrumented the service manager while
I was at it... and fixed a potential NPE in the AbstractService's
toString() method.
Fixed a bug in the DefaultClient where it couldn't be shutdown
if attempted before the services had been started.
2015-11-22 05:13:12 -05:00
Paul Speed
3a4624a5fe Added a bunch of javadoc and changed the names of one of the
method sets to be a little less confusing.
2015-11-16 02:38:45 -05:00
Paul Speed
95aa2d72d0 Added a basic RMI service that uses the RPC service.
I'll add some more javadoc in a sec.
2015-11-16 02:04:31 -05:00
Paul Speed
95603c46c4 Added a better check. The old one had the side-effect
of registering the class if it wasn't already registered.
2015-11-16 02:03:27 -05:00
Paul Speed
dfe4b083f0 Added a check to try and detect the case where a server and
a client are running on the same instance.  This should cover
99% of the cases where this would come up... and the others
can't really use this service anyway and so must disable it.
2015-11-15 02:24:18 -05:00
Paul Speed
4b2f361026 Modified to skip registering the message classes if they are
already registered.  This avoids one of the issues of a client
running in the same JVM as a server that already registered these
classes.  This was the easy fix.
2015-11-15 02:22:53 -05:00
AlrikG
7b6a742f0f Update GZIPSerializer.java 2015-06-22 17:12:12 +02:00
AlrikG
2cf7d9eb5a Update GZIPSerializer.java 2015-06-22 17:11:50 +02:00
Alrik
1eedfa5a5f - fix GZIP and ZIP serializer copying the whole temporary buffer instead
of only the part where the data was written.
2015-06-22 17:04:50 +02:00
Paul Speed
4bd774a653 Created an abstract hosted connection service that has
the autohost, start/stopHostingOnConnection support built
into it.  This is a very common things for connection based
services and I got tired of cutting/pasting it all the time.
RpcHostedService was modified to extend this base class
instead of the more basic one.
2015-05-28 01:10:44 -04:00
Paul Speed
9a8aa3b394 Prevent an NPE for null parameter arrays. 2015-05-11 02:28:56 -04:00
Paul Speed
42105f4c4b Just some whitespace changes. 2015-05-02 00:41:47 -04:00
Paul Speed
c1670e7509 Added the read class ID to the bad deserialize
exception.  Two things can cause bad reads:
1) bad data in the stream... in which the extra info
   is useless or confusing.
2) unregistered classes or bad timing, either way,
   knowing the message type ID might be useful.
2015-05-02 00:39:41 -04:00
Paul Speed
58313c271d Added a better comment as to why we have to check
the channels even though the negative channels would
pass through as the default channels just fine.
The key is avoiding UDP calls... they will get
translated into a regular send.
2015-05-02 00:38:24 -04:00
Paul Speed
c1dc819953 Added the ability to put the serializer registry
in "read only" mode.  Modified the SerializerRegistrationMessage
to put the serializer registry into read only after
it compiles the message so that the server won't accidentally
register messages after they've been compiled.
2015-05-02 00:35:15 -04:00
Paul Speed
33d21c2de3 Added an isStarted() method to Client. 2015-05-01 02:26:33 -04:00
Paul Speed
323daeb94f Added a getRpcConnection() method to expose the underlying
RPC support.
2015-05-01 02:25:24 -04:00
Paul Speed
a77ed52777 Added getServer() and getClient() convenience methods. 2015-05-01 02:24:52 -04:00
Paul Speed
e000d83ae7 Fixed a stack overflow exception if one println()'ed
a service... since most service managers print their
services in their own toString().
2015-05-01 02:24:16 -04:00
Paul Speed
57dbf384a2 Modified the DefaultServer to send a second client
info message to indicate that all of the local hosted
services have been notified about the new connection.
Modified DefaultClient to wait to start its services
until it has seen this second message.

Client services may want to send things to the server during
their start() method but it's important that things like
the serializer registry service has already processed its
messages or any sends might fail.  The client generally has
the luxury of being able to register handlers/listeners/etc
during initialize where as the server must do this when the
connection arrives.  So it seems reasonable to delay client
service start() until all of the server-side hosted services
have had a chance to initialize themselves.
2015-05-01 02:15:41 -04:00
Paul Speed
7bea2cc9c7 Fixed a missing import. 2015-04-26 03:10:47 -04:00
Paul Speed
96dab5f561 Allow remote calls to be made on the default channel
instead of just custom channels.  Custom channels are
0-max channel while -1 indicates the default send().
2015-04-26 02:28:38 -04:00
Paul Speed
dd65580bf3 Pre-register the inner class as well. A cut paste
error from my originals.
2015-04-26 02:27:27 -04:00
Paul Speed
8b34e4890a Fixed a comment to be more accurate with respect
to handler method argument types.
Fixed a small bug in how auto-detect worked.  It
was too greedy in looking for two-argument methods
and would somehow allow methods that took a first
argument that was not a connection type.
2015-04-26 02:26:47 -04:00
Paul Speed
1145f99d03 Added a service that will send the server's serializer
registration set to each new client that connects.  The
client-side version of this service will then register them
all.  This means that serialized classes need only be registered
on the server.
I've modified DefaultClient and DefaultServer to register these
services by default because they make other services easier to
write and because they will save people lots of trouble.
I'm 90% sure there are no bad side-effects for people who choose
to continue doing things the old way but it may depend on when
they register their serializers in relations to creating the
client and server objects.
2015-04-26 01:19:38 -04:00
Paul Speed
35155c6b5b Integrated the new service manager stuff with Client and
Server.  (Untested at the moment but straight forward.)
Also fixed a small but silent bug in DefaultServer when
closing out endpoints that were never fully connected.
Garbage was left around in the "connecting" data structure.
2015-04-26 00:57:02 -04:00
Paul Speed
1eb2ba7276 Adding an initial implementation for a service manager module
with custom subclasses and service interfaces for client 
services and server-side services (HostedServices).
This code is a copy and refactoring of code I developed for
Mythruna... it worked there but I haven't tested it yet in its
new form.  Things may change as I integrate this more closely
with the core Client and Server classes.  I wanted to get it
into source control first.
Also included an RPC service implementation which can serve
as the underpinning for other things.
Coming soon: serializer registration service and a simple
RMI service based on the RPC layer.
2015-04-26 00:24:51 -04:00
Paul Speed
9abedf284e Added a message that can be used to compile and
send the serializer registry... and then register
them on the other end.
2015-04-26 00:09:24 -04:00
Paul Speed
c9eaeeea12 Added some message delegator util classes that
makes it easier to handle network messages.  These
delegators can introspect a delegate type to find
message-type specific handler methods.  This mapping
can be done automatically or performed manually.
2015-04-25 23:47:26 -04:00
NemesisMate
2aa6f9f521 Fixed BufferUnderflowException
Fixed the exception occurring when using this serializer. More commented here:

http://hub.jmonkeyengine.org/t/savableserializer-and-client-bufferunderflowexception/31774
2015-02-26 14:41:29 +01:00
shadowislord
f31911f039 * Fix java 8 syntax error in UdpEndpoint 2014-05-31 17:36:49 -04:00
shadowislord
6b12d5c638 * Fix many javadoc errors mostly related to incorrect HTML or missing references 2014-05-31 13:12:46 -04:00
Normen Hansen
a16857c8f4 switch to gradle layout 2014-03-21 02:32:11 +01:00