P4Java is inherently thread-safe when used properly. The following best practices can help to ensure that users do not encounter thread-related problems:
IServer
object is partially thread-safe. The
only state preserved in the underlying implementation classes is the
Helix Server
client that is associated with the server, and the server’s
authentication state.IServer
object simultaneously, but note that changing
authentication state (login state, password, user name, and so on) or
the client that is associated with the server can have unpredictable
results on long-running commands that are still running against that
server object. You should ensure that changing these attributes only
happens when other commands are not in progress with the particular
server object.IServer
object can impose a heavy load on the JVM and the
corresponding server. To control load, create your own logic for
limiting thread usage. Be certain that your use of threads does not
cause deadlock or blocking. Consider using a single
IServer
object for each thread.