Question

I am a newbie......I have a Java Swing application and it runs great on my machine. I want to access this application from a Server via Citrix. So when I click on the published icon, it would run the main method in the jar file and will enable me to access the application. This application will be able to access a DB in the DB Server.

But I want mutliple users to access the application at the same time and that is where my questions are:

  1. I thought of creating n number of threads available for n number of users (i.e.) I can set a limit on concurrent access. But what will be the entry point.....I mean when I click on the published icon, it means each time the main method will be invoked.

  2. I can think of seperating my User Interface from the Logic layer....but I have no idea how to do it. ofcourse I am following MVC model. My question is in terms of creating multiple instances of the gui each time the application is accessed.

  3. And finally I want to use DB Connection pooling. So, would this mean that I have to create a separate java program that creates this pool and my application will use its datasource?

Can anyone please 'point' me in the right direction? I am not looking for specific ideas but just an idea on how to create this multi user application.

Était-ce utile?

La solution

Typically, for a multi-user Swing application you would want to separate the "client" part of the application from the "server" application.

This works as follows:

  • Each user would get their own running instance of the client application. This can be on their own machine.
  • The server application is a single instance (or maybe a cluster) that accepts connections from multiple clients and talks to the database
  • The client applications talk to the server application when they need to access or change data. There are a wide variety of different communication methods you can use.
  • Optionally, the server application can send notifications to the client (e.g. in situations where data is updated by another client)

You can do without the server application if you are happy to let the clients connect to the same database. This is simpler to set up, but has some downsides:

  • You need to be much more careful about concurrent access to the database / potential corruption from different clients attempting to alter the same data at the same time.
  • You need to allow connections to your database, from clients that are potentially untrusted. This is a security risk.

Given that you already have a working application, the second option is probably easier for you to move to. Just be aware of the downsides: the first option is a much better architecture in general.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top