1 |
dpavlin |
237 |
review of the OpenIsis Java interface |
2 |
|
|
|
3 |
|
|
* Java, Server and Sessions |
4 |
|
|
|
5 |
|
|
Approaching version 0.9 of OpenIsis, |
6 |
|
|
giving the concepts needed for a multisession server, |
7 |
|
|
we also have to revise the options for the Java binding. |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
When speaking about Java, we mostly have Java Servlet Engines in mind. |
11 |
|
|
Therefore we assume that we are running multithreaded, |
12 |
|
|
and that we have little control about the selection of threads. |
13 |
|
|
A client's request already has a thread dedicated to it, |
14 |
|
|
and this thread cannot do anything else before this request is served, |
15 |
|
|
i.e. requests can't be somehow queued or postponed. |
16 |
|
|
Therefore asynchronous access to a database is mostly pointless. |
17 |
|
|
All we can do is to synchronize access by blocking one thread |
18 |
|
|
while another accesses the same ressource. |
19 |
|
|
To not reduce concurrency to complete mutual exclusion, |
20 |
|
|
we clearly need database sessions. |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
Moreover we have to assume that we have multiple users, |
24 |
|
|
which might be represented by Http sessions. |
25 |
|
|
Where database sessions are configured to keep results sets, |
26 |
|
|
they should be bound to Http sessions. |
27 |
|
|
Otherwise we might pick an unused database session from a pool. |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
* Java on a local db |
31 |
|
|
|
32 |
|
|
The situation of a local database accessed from a servlet engine |
33 |
|
|
is similar to that of a dedicated database server in that we |
34 |
|
|
have multiple sessions and multiple threads. |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
The multiplexer, ensuring that there are no two |
38 |
|
|
requests running in parallel on a given session, |
39 |
|
|
is implemented in Java by synchronizing on the Java |
40 |
|
|
object representing each session. |
41 |
|
|
|
42 |
|
|
The creation of a session is synchronized on the default session. |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
A servlet engine accessing a local db may not only |
46 |
|
|
create cute looking HTML pages (by means of JSPs), |
47 |
|
|
but may also provide a general purpose database server, |
48 |
|
|
speaking a HTTP wrapped variant of the server protocol. |
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
* Java as client of a remote db |
53 |
|
|
|
54 |
|
|
On the other hand, a database session might be a client session |
55 |
|
|
bound to some OpenIsis server. |
56 |
|
|
|
57 |
|
|
Since the protocol used for communication with a server is pretty simple, |
58 |
|
|
and we will use synchronous access anyway, |
59 |
|
|
we are planning to implement this in pure Java. |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
This will remove the need for JNI, which has some problems |
63 |
|
|
especially where servlet engines deploy multiple class loaders |
64 |
|
|
for what they think are "web apps". |
65 |
|
|
|
66 |
|
|
|
67 |
|
|
--- |
68 |
|
|
$Id: Java.txt,v 1.1 2003/01/07 19:28:25 kripke Exp $ |