Mutithreading for multiple roles in a distributed application?

Hi experts,
I am writing a background-running application that serves in three roles: Client, Middleware and Server. It does some thing like file-sharing in Kazaa. Client hands in requests thru Middleware to Server. Server send the file back and Middleware decrypt it before passing to Client.
The middleware maintains a dictionary of file-links, server address where the file is stored and the decrypting key to the file.
The dictionary is implemented by 3 vectors and get serialized/deserialized with the application exit/start.
I want to exploit multithreading in this application. In other words, the application can work as different roles at the same time. For instance, the middleware is decypting file when a request is received for server, and the server starts to transfer file along with the decrypting.
Issues: the dictionary shall be consistent
My thought: Have a top level app class that deals with communication among peers. One class for each role. They all extends Thread. A new thread is instantiated and started when a corresponding request is received.
A client thread calls wait() when a request is sent off. It is notified by the app when response comes back.
The dictionary's read and write (i.e. add(), get()) are both synchronized to maintain consistency.
My questions:
1.Will my design work correctly?
2.Is this the right/conventional way to do this sort of things?
3.I am not sure about the wait(). Will it be better to write two methods, one for sending requests, the other one for dealing with responses?
Thanks a lot in advance

Hi, well, I thing I am not a expet but I think I can give you some help
I think that you should let the main thread (that one created when the JVM runs Main method) only to run the GUI or other kind of user interface or no one will be able to close the program or request for files
The main thread start the server thread and the server starts a new thread for handing each request just like you said
For each request the main thread start a client ,it send the request and the input method will call read you will not have to call wait because the read method blocks until the response arives
I could not undestand very well the middleware, could you tell me more about it?

Similar Messages

  • Report to fetch assigned transactions for multiple role.

    Hi,
    I am looking for some report or the way, i can get the list of transaction assigned to multiple roles in one go.
    Actually i tried SUIM, but here i have to specify one role at a time and have the list of transactions assigned to it.
    My scenario is, i have around 100 composite roles. Now there is a requirment for a report, which gives information of transactions assigned to each role. If i do it one by one, i have to do it for 100 times.
    Please suggest the best and quickest way.
    Thanks & Regards,
    Pravin

    > Another way could be to look into the AGR_1251 table for object S_TCODE values. But, this will populate transactions that could possibly not have included intentionally (in the menu). For eg there are many transactions which need authroization for another tcode in the background which have to be inserted as an authroization value.
    Which is good, because those are the actual tcode rights, not only the intended ones......
    To do this for composites I disagree with Julius on using Excel or Acces
    Try the SAP query tools, they're there for you. If you go to the quickviewer (SQVI) you can easily join tables AGR_AGRS and AGR_1251 by AGRNAME. Now if you look for object S_TCODE you can see the relation between a tcode assignment and a composite role.

  • How to make "check for multiple logons" mandatory in webdynpro application.

    Hi SDN members,
    Im having a problem with an application developed in webdynpro abap.
    We require that  end-user only have a session per computer (ip address),
    I already tried to achieve this by configuring the webdynpro application throguh SICF and going to Error Pages -> Logon Errors --> System Logon and mark the checkbox Check for multiple logons.
    This configurations give only a warning when the user logs multiple times, and show a checkbox letting the user decide to end or not the previous sessions.
    How to make end previuos sessions mandatory ??
    Regards,
    Franklin Cedillo

    You would have to enforce this at the application level. You can get the IP address of the current client from the framework - IF_WD_APPLICATION method GET_REMOTE_ADDRESS.
    You could write an entry with the IP address into a temporary table during WDDOINIT.  You could clear the entry in the WDDOEXIT.  Also during the WDDOINIT, check to see if there is already an entry for this IP address.  If so, then fire an exit nagivation plug to a static MIME object or BSP page that explains why the user can only be logged in once.

  • Disable an Authorisation object for Multiple roles.

    Hi ,
    I need to Disable an authorisation object F_BKPF_BUP for about 345 roles.Is there any way by which we can make mass changes.Doing it for individual role would take a lot of time.kindly advice.
    Thanks in advance

    Hi,
    1. Go to SE16 --> table  USOBT_C --> put object F_BKPF_BUP in the field "Object" --> execute without restriction. Download the list of TCodes.
    Now go to Table AGR_TCODES --> put the list of TCodes (found with above method) in the field "Extended name" as multiple selection --> execute and download the list of roles.
    Look up your list of 345 roles with this list. After matching, you need to sort out the TCodes present in this list of roles which is checking the object F_BKPF_BUP.
    2. Now go to SU24.. go to option "Authorization Object" and NOT in the Transaction section.
    Put the Object and execute.... go to change mode.... check the proposals for the TCodes you sorted at last step of point 1. Make the proposal Do Not Check where ever it is not so.
    Move the Workbench Transport through Landscape. Your purpose will be done. But you should also keep in mind if the TCodes are present in other roles besides of your 345, those will become vulnerable.
    Regards,
    Dipanjan

  • Same JVM for multiple Frames in a web application

    Hi guys,
    I have a web application that loads an applet during login. Once the login is completed, the web application will display the available functions accessible with a menu on the left frame and the main display page on the right frame. Whenever any form action is perfomed on the right frame, the jvm with the login session seems to exit (java console closes) and the applet will be loaded to prompt the user to login again. The JRE installed on the Windows client is 1.6.0_14 from SUN.
    I'm guessing that the different frames are using different JVMs?
    Is there a way to use the same jvm for a web application with multiple frames? I want to prevent the case where the user will have to login again.
    Thanks for any advice!
    - Zen -

    I have sort of the same problem
    [Identical applets in the same JVM, next generation plugin issue|http://forums.sun.com/thread.jspa?threadID=5396118]
    I have submitted a Request for enhancement to SUN to allow forced grouping of applets in the same JVM.
    Sort of the opposite of the "separate_jvm" Applet tag parameter.
    It seems there is currently no way to do this.
    [New Plugin command line args|https://jdk6.dev.java.net/plugin2/jnlp/#COMMAND_LINE_ARGS]
    When per-applet JVM command-line arguments are specified, it is likely that the new Java Plug-In will need to launch another JVM instance in order to satisfy them. In other words, it is unlikely that a preexisting JVM instance will have been started with the correct set of command-line arguments to satisfy the current applet's request. The rules for exactly when a new JVM instance is launched to start a given applet are deliberately left unspecified, as this functionality is brand new in the 6u10 release and may need to change in subsequent releases. Here is a rough set of guidelines for the sharing and creation of new JVM instances:
    * If the command-line arguments used to start a preexisting JVM instance are a superset of the requested arguments, the preexisting JVM instance will be used.
    * If a JVM instance is launched for the "default" set of command-line arguments (i.e., those specified in the Java Control Panel, with no per-applet arguments specified), then this JVM instance will never be used to launch any applet that has even one per-applet command-line argument.
    * -Xmx is handled specially: if a preexisting JVM instance was started with for example -Xmx256m, and a new applet requests -Xmx128m, then new applet will very likely be run in the preexisting JVM instance. In other words, -Xmx specifications are matched with a greater-than-or-equal test.
    There is no way to "name" a JVM instance used to launch a particular applet and "force" subsequent applets into that JVM instance.
    See the section on the separate_jvm parameter to isolate a particular applet in its own JVM instance, separate from all other applets.

  • How to configure request manager service for multiple website in one web application

    I have set up sp 2013 as below:
     web application : wa1
    site collection : sc1
    sp site: site1, site2
    I used 2 WFE, 1 APP, how can I use request manager service to control  site1 to wfe1, site2 to wfe2?
    Awen

    That's not what i'd describe as load balancing.
    A better description would be load-isolation. In your description then if the load on site1 was large (and growing) but site2 was quiet then site1 would struggle and eventually become unable to handle the number of users but site2 would still be ok. That's
    fine from a QOS point of view but it's not the norm for load balancing. It would work in simple scenarios but the out of the box load balancing tools are much better suited than that sort of approach.
    This article shows how to configure the RMS and may help show how your request is difficult to configure:
    http://www.harbar.net/articles/sp2013rm2.aspx

  • Using MainStage/Logic live as effects/processor for multiple audio inputs in PA application

    I have a Mackie Onyx desk with firewire and Mackie control surface that I use for recording. Could I use either Logic or MainStage in a live application with the Mackie as audio input/output but using Logic processor/fx inserts on each audio channel?
    Effectively using the software to replicate digital mixing desk processing
    I can use either my iMac or Macbook pro
    Has anybody done this (I'm sure you have), good points/bad points "don't even think of it!" comments appreciated
    Thanks
    Tim
    BTW, now using Mavericks OS but haven't updated my signature :-)

    should work fine.  Hopefully your machine can handle low-latency (like a 128 setting in the audio prefs).  The lower the better, but you don't want to over-stress your machine, so experiment with those settings.

  • Single sign on for multiple organization with one base application (multiple InssuerNameregistry)

    1.
    I am going to host this as a service and dont want to add IssuerNameRegistry in
    web.config every time whenever i am adding new organization. I Need to pull the details from DB and set it dynamically (token, url etc). I tried to do that based on the return URL . But this fails because FederationConfiguration can be only updated in Application_Start
    Event. I cant do that because i cant access my HTTPContext to know the return url in my App_Start.So
    i kept a separate Config file and had all my authorities configured for all Organizations in it. But our client raising a question on security and the performance. Is it advisable to keep the sensitive data in XML for all the organizations and also we are
    concerned about performance. if the return token go and read all the keys to validate against it’s token, will the system be Slow
    Please advise me with some sample code to achieve this..
    2. I tried to implement ValidatingIssuerNameRegistry but unable
    to success since it is talking about updating the tenent id based on the Metadata.xml.
    All i have is the following info for all the organizations
     <authority name="http://test123.login.edu/adfs/services/trust">
              <keys>            <add thumbprint="{Thumbprit}" />
              </keys>
              <validIssuers>
                <add name="http://test/adfs/services/trust" />
              </validIssuers>
            </authority>

    Hello,
    For issues regarding ASP.NET, I suggest you post it to:
    http://forums.asp.net
    There are asp.net experts who will help you better.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can i install itunes multiple times on one computer for multiple users?

    Can i install itunes multiple times on one computer for multiple users?

    Like most applications you only need to install it once for it to be available to all users. (That said it is possible to install an application and only make it available to the current user, but that's rarely needed.)
    tt2

  • Shall I use one datasource for multiple connection pool?

    Hi,
    I need to clarrify that, Shall I use one Datasource for multiple connection pool in distributed transaction?
    Thanks with regards
    Suresh

    No. If its transactions across multiple databases you should use different datasources.

  • Add 1 transaction to multiple roles

    Hi There,
    I am responsible for the authorization of the sap customers for my company.
    We have multiple roles for multiple company's within our own company.
    Butt when i must add one transaction to the role admin, i must ad the transaction for al the roles of the different company's. admin company 1, admin company 2, and so on.
    Is there an transaction i can do mass change's for multiple role's.

    Hi,
    There is a another way also, it could be done.
    Create One common Role - <b>zrole_common</b>
    This should be added to all admins of all companies
    Create seperate Role for each company ( excluding auth in common role).
    <b>zrole_company1</b>
    <b>zrole_company2</b> etc.
    Now assign <b>zrole_common</b> and <b>zrole_company1</b> to <b>company-1 admin</b>.
    Now whenever, you wanted to add any common auth obj, add it to zrole_common and regenerate it, This will be effected to all admins.
    I am not sure, how your Roles are maintained now. But if possible, go for this proven way.
    Thanks,
    Raj Sam

  • How to restrict login for multiple users having same Role

    Our Web Application is deployed on Tomcat 5.5
    The requirement is ?
    There are roles in application like "operator", "admin"?
    There are multiple users created for each of the above role.
    When one user of "operator" role is logged in, then
    It should not allow to login for another user of "operator" role.
    Also, if user did not log out & application gets close, then
    It should not allow to login for another user of "operator" role.
    Also, it should not allow to login for multiple requests of same user
    (using another browser instance...)
    Is it possible using session object?
    But, using session object, it will create separate objects for different users,
    So here I will not be able to restrict session object creation rolewise.
    Also, how to retrieve these multiple session objects created for different users on server?
    If anyone is having the solution please reply as soon as possible,
    Thank you.

    To tell you the truth, this is a stupid requirement. It must be an extremely fragile application.
    In any case, you will have to write your stuff for that. Probably a filter that on login, logout, and session expiration checks, makes, or removes entries in a DB (using a synchronized resource to prevent race conditions) or possibly even simply in an application context object.

  • Whcih on is better for distributed application (Spring POJOs    vs  EJB ) ?

    Hi All,
    I want to develop a distributed standalone application in which I have used the following technologies
    Presentation Layer : Swings
    Business Layer : Spring POJOs
    Persistence Layer : Spring DAO
    I will deploy the business logic in remote location then I will connect to the business components through
    RMI.(without using EJB we can't get the middleware services, spring already provides some middleware services
    like transcations and security but I think it is not providing load balancing)
    If I use spring POJOs instead of EJB shall I get any benifits?
    If I use spring POJOs how load balance the applicaton?
    If we make multiple requests to the ejb container, multiple ejb objects will be created in order to provide the service in case stateless session beans. Is there any similar kind of service in spring POJOs?
    Can I use spring for distributed standalone applications ?(I want Spring POJOs with middle ware services).
    Is Spring best suitable for developing distributed standalone application?
    Please suggest me which technologies are best to implement the distributed applications.(For standalone applications)
    Thanks in advance
    krishna

    help_krishna wrote:
    Hi All,
    I want to develop a distributed standalone application in which I have used the following technologies
    Presentation Layer : Swings
    Business Layer : Spring POJOs
    Persistence Layer : Spring DAO
    I will deploy the business logic in remote location then I will connect to the business components through
    RMI.(without using EJB we can't get the middleware services, spring already provides some middleware services
    like transcations and security but I think it is not providing load balancing)
    If I use spring POJOs instead of EJB shall I get any benifits?Like what?
    You don't have an EJB dependency.
    You don't get what EJBs are good for. Do you know what they're for? Do you know why you might prefer one over the other?
    If I use spring POJOs how load balance the applicaton?Usually done in hardware (e.g., F5) or software (e.g., any Java EE app server) that's not yours. Your app should not be concerned with load balancing.
    If we make multiple requests to the ejb container, multiple ejb objects will be created in order to provide the service in case stateless session beans. Is there any similar kind of service in spring POJOs?Depends on how you configure it.
    Can I use spring for distributed standalone applications ?(I want Spring POJOs with middle ware services).Yes.
    Is Spring best suitable for developing distributed standalone application?Define "best".
    How well do you know Spring? If you don't know it well, I doubt that it can help you.
    Please suggest me which technologies are best to implement the distributed applications.(For standalone applications)You can write this app without Spring or EJB.
    Do you know how to write Java at all?
    %

  • How do I install an application for multiple users?

    ... not only for the administrator...

    They are all set up for multiple users if they are in the applications folder.
    ...JER

  • One CUP request for assigning role to multiple users

    Hi,
    We assign roles to users in production only through CUP requests.. We use GRC 5.3
    Here we have a case where we need to assign one role to  60 users in production(each user may have different  roles assigned in the back end) . I can raise one CUP request for all users using " multi-user" option in Copy request . But when we want to make a risk analysis , it will not show risks at user level as each user had different roles and may get different risks by adding new role.
    Instead it will give risks if any for only that new role which want to assign. Our manager is not accepting as this is not giving complete picture of risks for each user when we add new role.
    Please suggest me if there is any other way where I can make a risk analysis for each user when I created a CUP request for multiple users.
    Or the only solution is to create 60 CUP requests ?? this would be too manual
    Regards ,
    jaags

    Raghu,
    thanks for the reply, you are right as per the audit .But suppose if it is for 200 users ,creating 200 CUP requests will be impractical right.
    there should be some solution for this , because there will be many situations practically where we have to assign roles to N number of users.
    Is this possible in GRC 10 ? any idea ?
    Regards,
    Jaags

Maybe you are looking for