97 Commits

Author SHA1 Message Date
PSp..om
48db901b5b Added a method for easily determining if there are active
connections.
Early-return in the broadcast method if there are no connections.
This prevents allocation of a message if it's just going to get
dropped on the floor anyway.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8932 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-12-16 00:31:40 +00:00
nor..67
3cdaf0e051 jme3:
- fix imports in all classes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8843 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-12-03 14:06:48 +00:00
nor..67
c906508e62 - big refactoring of engine build and cleaning of sources, totally breaking SDK build for now
- separate jar files for engine components
- resolve dependencies between code parts
- remove Nifty dependency from Cinematics
- remove Physics dependency from TerrainGrid
- add public accessors to Natives Extraction
- remove RenderHint serialization from networking

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8839 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-12-03 01:22:42 +00:00
PSp..om
7a333dda9f On some platforms the selector will not automatically wake up
when the network connection has been closed.  Forcing the selector
to wake up seems to be safe on tested platforms.
Thanks to @philotomy for the catch and fix.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8669 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-11-14 10:51:25 +00:00
sha..rd
b3f9e87bf1 * package.html files now comply with HTML 4.01 standards
* SimpleApplication now computes FPS by counting frames instead of using Timer.getFrameRate()

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8534 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-10-28 00:49:07 +00:00
PSp..om
c548987709 Removing the deprecated packages and old version of the
networking layer.  Note: because some messages were removed
from Serializer's auto-registration this version is not
binary-compatible with the last.  So you must upgrade your
client and server at the same time.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8286 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-09-24 09:16:54 +00:00
PSp..om
3f6461a4a8 Made the static utility methods static. "D'oh!"
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8257 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-09-16 09:02:13 +00:00
PSp..om
1dbd617d2d Added a method to register classes in bulk.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8069 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-08-24 09:52:35 +00:00
PSp..om
8f90e62fec A change from a while back that presents a slightly better
error message than an NPE but still isn't very helpful.  This
usually only happens when things are totally confused, ie:
stream corruption or more likely misregistered classes.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8068 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-08-24 09:38:28 +00:00
PSp..om
d67adb8266 Pulled the ExecutorService stuff out and replaced it with a
plain single thread.  This gives more control over the queuing
behavior as with an ThreadPoolExecutor it is difficult to implement
blocking execute() behavior.  Also, this avoids creating an
extra object per-message.
Anyway, this code now implements a blocking queue instead of
a boundless queue.  It's set to 16,000 messages which should only
bottom out in the worst of cases.  I was seeing it in the throughput
tests where the sockets were backing up and the queues were 
consuming all of the heap until an out of memory error occurred.
Outbound messaging is only throttled this way on the client.
Servers typically wouldn't do this sort of spamming anyway.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7977 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-08-05 07:55:04 +00:00
PSp..om
d62c1311fb Fixed a long-standing but well hidden bug in message
protocol.  In the wild, I've only seen this crop up in
really really odd circumstances.  As it turns out, the 
throughput tests eventually trigger this when testing
TCP.  I've lost sleep over wondering when this was going
to bite for real so I'm glad to have what is essentially
the last known bug in message transfer fixed.
This change handles the case where so far only one
byte of the two byte message size has been read from
the network.  Rare, but it can happen.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7976 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-08-05 06:46:56 +00:00
PSp..om
a0dea25ec5 Fixed an event ordering issue. The server now only
first the connection added event after sending the
connect confirmation to the client.  This prevents
a resource deadlock if the connection listener
tries to send a message to the client and the
client tries to send a response back... since the
client won't have been fully initialized yet.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7854 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-07-12 20:07:11 +00:00
PSp..om
68bac95cd5 Added some more information to the logging.
Removed an errant nextId decrement that would occur
even if the class was already registered and already
had an ID.  This makes the teetering tower of glass
shards slightly less fragile... slightly.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7722 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-06-24 10:06:41 +00:00
PSp..om
98267c3d0f Added a check for no-arg constructor during initialize
to avoid having to wait to find this out until a message
is sent.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7694 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-06-23 08:19:06 +00:00
sha..rd
8cbb0f210d * Small javadoc fixes
* Formatting for com.jme3.effect package
 * Formatting for blender importer and networking tests
 * All networking tests ported to new SpiderMonkey
 * Removed all mentions of java.util.Serializable
 * RMI now works under new SpiderMonkey

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7593 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-06-12 05:17:41 +00:00
PSp..om
71df4f9acd Client will log the exception that causes it to disconnect
just in case the caller has not registered any listeners.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7525 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-25 20:33:59 +00:00
PSp..om
e6c9cbac12 Modified the setAttribute() method to remove the attribute
if the value is null instead of throwin an NPE.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7485 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-11 17:12:01 +00:00
PSp..om
8ed2db29a6 Reworked how client connection teardown happens in the face
of the network connection disappearing or any other random errors
on the channel.  Now errors that cause the connection to drop
will be properly reported as client disconnects... there is also
a new error field on the DisconnectInfo that is filled in in these
cases.
Added an ErrorListener that can be used to more tightly control
how errors are handled for the Client.
Fixed the double event dispatch that occurred during Client
closing.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7451 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:59:52 +00:00
PSp..om
95315cfd0c Fixing a pretty significant typo.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7450 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:49:18 +00:00
PSp..om
17221395dc The KernelAdapter now keeps a rolling message buffer
for the endpoints when using a reliable connection.
There is no guarantee that the buffers going out from
a client won't be chopped up by the networking stack
in various ways.  It was always the intent to accumulate
them like this (the client side already does after all)
but it was an oversight.  It's a testament to modern
networking that this hasn't come up in practice yet.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7449 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-05-05 05:07:28 +00:00
PSp..om
1b837fe7ea Make client-side background threads daemon.
Reduced the amount of logging from invalid UDP messages
received.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7314 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-26 21:53:49 +00:00
PSp..om
2bc6e27200 Proper fix for the bug where JME's quaternion wasn't
being serialized automatically.
When a class is final and in the field of a class that
is registered, it is safe to register it automatically
because the type can be determined reliably on the
other end of the stream.  So now it allows that.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7276 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-20 17:41:15 +00:00
nor..67
1203073bd9 - make SM Serializer only display warning instead of throwing an Exception when the class has not been registered, internally supported classes like jME math primitives were not accepted anymore
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7267 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-20 13:58:26 +00:00
PSp..om
d0a5ce55b9 Moved some exception handling to terminate connections
that throw low level exceptions.  The specific case I
saw for this was "An existing connection was forcibly
closed by the remote host" IOException.  Without this
new handling, SM continually tried to send the connection
its data.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7260 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 17:27:11 +00:00
PSp..om
9073820361 Reuse one big buffer per thread and copy the outbound
smaller buffers.  Way faster and way cheaper overall.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7259 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 05:56:52 +00:00
PSp..om
85b4eea8d7 Name the executor threads based on something that might
be useful to someone debugging thread dumps. ;)


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7258 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 03:48:41 +00:00
PSp..om
7d6d513fa5 Modified the DefaultClient (really its ConnectionAdapters)
to send their outbound data on a background thread.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7257 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-18 03:17:18 +00:00
PSp..om
e298a4357e Modified the toString() for UdpEndpoint to include
the address instead of the socket... since they all share
the same socket anyway and the datagram sockets don't 
have useful toString()s.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7256 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-17 21:14:41 +00:00
PSp..om
5225599ee2 Fixed a case where an exception would kill the kernel
adapter thread.  Also improved the details of the error
logging.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7255 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-17 21:04:09 +00:00
PSp..om
593d9bf35a UDP-based kernel now does its writes on a background
thread.  Most of the time UDP packets go right out
but not always... depending on the network layer it can
take a couple of milliseconds.  And that's alot when
you're blasting packets out to a dozen users 20 times
a second.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7245 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 03:51:43 +00:00
PSp..om
1f1c2ac15b Tightened up the DefaultServer connection close code
to make sure that the connection closed change event
only goes out once.
Added some additional logging to the endpoint closings.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7244 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 01:54:51 +00:00
PSp..om
189a787d36 Added some warning for some odd state issues that can happen
in real life.
Fixed a subtle bug with the UDP endpoints where they weren't
getting propery closed.  This manifested as the endpoints
still getting broadcasts even after Server no longer knew
about them.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7243 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-16 00:13:25 +00:00
PSp..om
c5ac1c8bfe Modified to throw an exception if the class of the object
being written hasn't been registered yet and does not
have an explicit ID set.  The old way would try to send
it anyway and then it would fail to get received on the
other end.
A setStrictRegistration(false) method can be used to get the
old behavior if needed.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7222 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-09 08:07:25 +00:00
PSp..om
0f1b05b405 Fixed the few uncheck warnings that I could... suppressed
the rest.  Added an UnsupportedOperationException to 
SerializableSerializer so that it doesn't silently fail
to do anything at all.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7219 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-08 02:55:21 +00:00
PSp..om
49f65bd7aa At least fixing the type-check warnings in the code I added.
Serializer is a little harder...


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7218 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-08 02:01:52 +00:00
PSp..om
4deb4d46e7 Improved the exception handling when objects fail
to instantiate.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7217 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-07 22:40:53 +00:00
sha..rd
cbbb261828 * Made sync system deprecated
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7188 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-05 02:28:49 +00:00
PSp..om
041f47157d Modified serializer to throw an exception if it tries
to read from a buffer and doesn't understand what class
it's reading.  Error messages... it's the little things
that matter.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7180 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-04 01:01:17 +00:00
PSp..om
858925182e Added a log INFO message for when messages are dispatched
and no listeners are registered to receive it.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7154 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:42:13 +00:00
PSp..om
d3364b4622 Fixed an NPE (apparently harmless) for a certain connection
teardown ordering and added some logging just to be sure
the channels are getting closed.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7153 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:33:13 +00:00
PSp..om
50465e37b3 Fixed a getConnection() bug caused by a silent autoboxing
issue left over from when the long -> int client ID 
conversion was made.  Now connection lookups work again.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7152 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-04-01 21:23:48 +00:00
PSp..om
37cc6e581d Deprecated registerPackage() and added a log INFO to
log all classes that are registered.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7136 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-28 19:33:41 +00:00
PSp..om
f7f47a13e4 Modified to log and continue when the message/event
dispatch throws exceptions.  This protects the server
from dying just because of a bad listener.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7125 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 07:17:54 +00:00
PSp..om
6465dbd516 Removing an errant println.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7124 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:47:29 +00:00
PSp..om
e58ec4b8a0 Added code that will wake up the blocked kernel-caller
if there are events to deal with.  This wasn't a big
deal for connects because there's always an accompanying
message but for disconnects we wouldn't get events until
the next message came through.  Always meant to go back
and fix it and now I have.  Note: this is because our
adapters use a single thread for pulling envelopes off
and for dispatching connection events.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7123 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:39:00 +00:00
PSp..om
3fc0d506f4 Added some info logging for connection close events...
we log connect, might as well log disconnect.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7122 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:37:06 +00:00
PSp..om
99a21a8c1d This would have saved me soooo much time. Serializer's
single-arg registerClass() method now throws an exception
if the object is not marked Serializable.  Internally,
the package-load stuff uses the new alternate method that
allows safe non-exception throwing registration since it's
hitting it with every class in a package.
Interestingly enough, messages will still get written out 
because of some questionable code in writeClassAndObject()...
but it won't be read as anything but null despite its
40+ bytes of data.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7121 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-27 05:31:21 +00:00
PSp..om
5012b2d3dd Use an extra byte per final-typed field to handle
the case of nulls.  Note: this is specific to
serialized objects and is therefore not adding
a byte to things like Strings or arrays... those
will have to be reviewed separately.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7119 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-26 22:44:09 +00:00
PSp..om
3e5973793e A better exception for errors that really should have a root
cause.  It's possible to set it right on IOException but not
at all convenient.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7118 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-26 21:32:49 +00:00
PSp..om
7e3020fd07 Forgot to actually check the udp port for server
creation... now it properly disables UDP for -1.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7107 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-03-24 19:31:30 +00:00