Multi-Threaded server using  ThreadPool

Dear friends,
I am writing a client-server program in which the client and server communicate using SUN-RPC. The client reads a file containing some numbers and then spawns threads which it uses to request the server for a service. These threads are executed using a thread pool. Till this time, it's working fine. But when it comes to the server, the real trouble begins because it too needs to be made a multi-threaded one using thread pooling. The server has to capture the call information for each request for the service and then pass this information to a thread/runnable object in whose run() method the code for execution of the service would be present. Since the tasks(requests for the service) are not present already, i am unable to execute the server side threads in a loop using a thread pool. How to solve this problem? Kindly help.
Thanks,
Subhash

The server has to capture the call information for each request for the serviceWhy?
and then pass this information to a thread/runnable object in whose run() method the code for execution of the service would be present.Why can't the run() method get the call information when it starts? That's what's normally done. The server's accept loop mustn't do any other I/O: otherwise a rogue client can block the server complete.y

Similar Messages

  • Multi-threaded server programming

    Hello, I meet a problem and don't know how to solve it: I have created a multi-threaded server program which receives multiple users from their own PCs. The server program receives users'commands and echo it back to all users who are currently connecting to my server. I store every clientSocket connecting to my server into a vector. My question is: how the server broadcasts a user command to other users? And how the server knows to which user he will echo the command to since the hostName and port number are the same to every user currently connecting to my server? Thanks a lot.

    You should look at extending the Socket class to encorporate user details. Either use what peter suggested or make the user pass a username (or something) when they connect.
    When you want to broadcast to all users just enumerate through your vector and send each one the command. If you mean the user performs a task on their application and you want to produce the same results in all the other users apps then its down to you to code it. When user1 clicks on a button the app must send a command (eg. a string) to the server which sends the same string to all other users. When the user receives this string it performs some task.
    Is that what you mean?
    Ted.

  • Enterprise User and Multi Thread Server

    Hi,
    We are going to build a system which uses a configuration:
    10g2
    Enterprise User
    Multi Thread Server
    Client apps accesses db over JDBC/SSL
    Could some please share experience about issues regarding
    using Enterprise User and Multi Thread Server ?
    Is MTS transparant for Enterprise User authentication ?
    Regards,
    Cezary

    If you build simpserv with -t, and set MIN and MAXDISPATCHTHREADS, you
    should have an example of a multithreaded server.
         Scott
    Johan Philippe wrote:
    >
    We have been going to the documentation on multi-threading and contexting in servers
    on Tuxedo 7.1.
    And the impression so far is that apart from the function definitions there is
    not much information around.
    Didn't even find a simple example of a multi-threaded server in the Bea refs yet.
    Does anyone know/have such an example?
    And is anyone using multi-contexting in a server, because the limitation that
    only server-dispatched
    thread get a context puts quite a limitation on its usefullness.

  • Can anybody know how to configure Multi threaded server?

    Hi
    All,
    Can anybody know how to configure Multi threaded server?
    Thanks,
    Vishal

    Values are just samples only. use what ever appropriate for your environment. Understand each of them before using in production.
    alter system set DISPATCHERS="(PROTOCOL=tcp)(DISPATCHERS=3)(CONNECTIONS=1000)"
    alter system set shared_servers=100
    replace "DEDICATED" with "SHARED" in tns names
    Ready to go.
    select username,server from gv$session (server should show none or shared)

  • Multi-threaded server with independent IO

    I have designed a multi-threaded server which handles XML via sockets. I am running into the issue that when I try to send data to all of the clients, I have having to iterate through a shared resource where the sockets are stored at. I do not have this problem with reading because it is done in the thread created for this client (I pass the socket into the thread). If one computer freezes, then the iteration (writeToAll) through the client sockets also freeze. I would like to send XML to all clients and have everything fully independent so if it has a problem writing to a client, then it wouldn't halt the server. I would spawn a new thread for each write but that wouldn't be practical and I worry about threads live-locked.
    I have looked into JCSP and it looks promising for the common issues associated with thread programming, but this is more of a design issue.
    Any robust multi-threaded servers out there for enterprise use and scalability?

    A basic server which provides an example of what I mean:
    http://www.wellho.net/solutions/java-a-multithreaded-server-in-java.html
    connectiontable is a non-synchronized static method; I use a synchronized non-static method. I do not know which one I need to use.
    The problem: If a socket "lingers" on sending output* (ex if the client is frozen but the socket is still bounded), then it never throws an exception!
    *Sending from a shared resource (hashtable) on the parent thread (where the serversocket resides).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Multi Thread Server over TCP/IP

    Multi Thread Server over TCP/IP. Does it work?
    In my box it works only over IPC protocol.
    null

    S C Maturi (guest) wrote:
    : Mark Malakanov (guest) wrote:
    : : Multi Thread Server over TCP/IP. Does it work?
    : : In my box it works only over IPC protocol.
    : Mark,
    : Multi threaded server over TCP/IP will not work with
    : the current distribution of Oracle 8.0.5 on Linux.
    : This is corrected and a patch would be released soon.
    : Maturi
    tcp 0 0 bock.nettek-ll:listener bock.nettek-
    llc.co:4196 ESTABLISHED
    tcp 0 0 bock.nettek-llc.co:4196 bock.nettek-
    ll:listener ESTABLISHED
    (I have serveral of these)
    TNS Ping Utility for Linux: Version 8.0.5.0.0 - Production on 07-
    JAN-99 18:45:52
    (c) Copyright 1997 Oracle Corporation. All rights reserved.
    Attempting to contact (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)
    (PORT=1521))
    OK (440 msec)
    ...and from my install log you see that I selected MTS:
    -[ YESNO
    Q> Would you like MTS (Multi-Threaded Server) configured
    and the SQL*Net$
    A> TRUE
    Please explain? Will TCP/IP MTS work via the loopback adapter
    only? So far I have not tried a remote TCP/IP connection.
    -STEVEl
    null

  • Found dead multi-threaded server

    hi all
    My database is not running in multithread mode.
    mts_dispatchers = "(protocol=TCP)"
    I am getting such error
    found dead multi-threaded server 'S000', pid = (8, 4)
    Pl guide me
    suresh

    go on metalink http://metalink.oracle.com
    Good Luck,
    Fred

  • Found Dead Multi-Threaded Server Error!!!

    I am in the process of testing an application based on EJBs deployed on an Oracle 8.1.5 database.
    Some times the whole instance chashes without any obvious reason.
    The error reported in the Alert file is
    "found dead multi-threaded server 'SOOO',pid(8,1). Terminating Instance".
    I check my code and i think that there is no problem with cleaning up resources. I increased also the JAVA_POOL_SIZE and LARGE_POOL_SIZE size without any result.
    Can anybody give me a hint for the error cause?
    Thanks in advance.
    null

    go on metalink http://metalink.oracle.com
    Good Luck,
    Fred

  • Dedicated server vs multi threaded server archcitechture ( shared servers)

    http://www.dba-oracle.com/t_mts_multithreaded_servers_shared.htm
    1. I read the above for dedicated server vs multi threaded server archcitechture ( shared servers), please make it easy for a novice like me to understand in brief. Is the difference between the two only that MTS spawn multiple virtual servers which share and same memor ?
    2. How does the dedicated server work right from a db user logs in to when the user logs out ?
    Thanks in advance.
    Gony

    Posting it in [General Forum|http://forums.oracle.com/forums/forum.jspa?forumID=61] is more appropriate.
    SS

  • Proble with multi-threaded app using the same connection

    have a multi-threaded app. The threads all share the
    same connection. They all do some selects / updates.
    The OS is NT 4.0 and the application server is weblogic
    Some times I am getting the error "java.sql.SQLException: Io exception: not in streaming mode"
    and some times I am getting "java.sql.SQLException: Io exception: Protocal violation
    Any Ideas?
    Regards
    Suresh

    Don't create threads.... Your threads should if they are necessary be reusable, your threads should call the connections it needs from the cache service with let's say a max number of N pools (each pool a max number of M connections), if the connection domain asked exists on cache a connection is asked for corresponding pool, if the connection domain is not on cache the less used domain is thrown away (all inner connections closed first) and substituted by the new one requested. While the pool is not full keep creating connections as the request came (and all existing connections are being held and not released), when M connections exists, a request should wait till a connection is released.
    If you can have 20 threads asking for the same connection and the max number of connections on pool is M=10, then yopur threads will wait for a connection being released. All this must be synchronized. You should set M the closest as possible to the normal number of requests you can imagine to happen the same time. You should get connection use it and release it right away if you can have a lot of requests.
    I hope this helps you.

  • Writing a multi-threaded server

    Hi. I'm working in a starting project here at my company and, as a requirement, I must implement a multithreaded server using SSL connections (SSL over Socket). The secure connection is no longer a concern (after a lot of struggle, I build a simple client/server over SSLSockets that actually works), but I still need to build all the multithreaded code... I'm needing some guidelines and design ideas. Any ideas? Can someone post some interesting links about this subject?
    Thanks in advance!

    >
    For example why must it be multi-threaded in thefirst
    place?Because it will serve a few tens of people
    concurrently.
    tens? Like 50 people or 500 people?
    And how many threads? 3 or 60,000?I do not know yet, but I'm assuming it will be one
    thread per socket connection and possibly another few
    threads doing housekeeping stuff (managing files,
    etc)
    And how long will a thread last? What sort of
    processing will it do?Ain't got all requirements yet!! But basically (at
    least what I understood) it's going to receive lots of
    data, process it and re-route the data to a mainframe
    So 5O (or 500) people are going to connect...
    1. Once a week and deliver 10 giga bytes of data?
    2. Once a minute and deliber 10 giga bytes of data?
    3. Once a week and deliver 1,000 bytes of data?
    4. Once a minute and deliber 1,000 bytes of data?
    And then the general questions for any 'server'...
    -What happens when the server (box or application)fails
    Well, nothing has been said about that matter yet, but
    I guess the server got to resume (or discard)
    unfinished stuff (depending on the status of the
    received data before the connection was lost)
    And how is it going to do that on the 'mainframe'?
    Two easy paths.
    1. The mainframe has a database interface AND the data volume is low enough then you can use transactions.
    2. The data does not have to be committed at once. This could be because it just doesn't always need to go, or because it is 'sequential' (which still requires code but not much.)
    Really hard paths.
    1. 'Lots' of data and it all must be committed at 'once'.
    2. There is no database interface and data must be committed.
    -What is the expected scaling requirements?No clustering involved - it will run on a single
    machine, during a limited time. The system in question
    is a 'contingency control' (not sure about this term
    in English), so it will run when (and if) our client
    get screwed in any way - their buildings destroyed,
    that kind of stuff...
    -How will it be maintained?Sorry, I didn't understood, could you clarify?
    Someone has to make sure the box and application is running. Who is going to do that? What tools will they need to do this?
    If it is you and the users call you directly if it doesn't work then it is easy (code wise.) If it is someone else then you will need to provide tools to ease that. And if someone expects it to work in an automated management system (like with SNMP) it is going to be even more complicated.

  • SAP XI on a multi-core, multi-thread server?

    Hi Everyone!
    Can anyone tell me whether SAP XI can run on a Server whose processor is multi-core, multi thread (4 cores, 8 threads per core, 32 threads)?
    Thanks in advance!
    Warm regards,
    Glenn

    Hi Ravi,
    Thanks for your reply! The server in question is SUN Solaris. What sort of confguration needs to be done on both the OS side and on XI? Is there a SAP note I can follow?
    Warm regards,
    Glenn

  • The CPU utilization is 0% for the other remaining processes when multi threading is used

    I am new to AE ,so I am trying to render a project enabling multi threading process the additional processes are present but their utilization is 0% .
    I want to juice out every single CPU utiliaztion .
    ANy help is greatly appriciated,.
    My system specs:
    AMD 9690 4.7 Ghz 8 core
    32 GB DDR3
    C:\256 GB Solid Satte Raid 0
    GeForce 780 Ti DDR5 3GB

    It is very tempting to try and use all of your system resources and multiprocessing for all your projects, but this is not the way After Effects works. Many third-party plug-ins, many codecs, and many operations do not respond well to multiprocessing. All it takes is one process in your entire thread that is not MP aware to foul the whole thing and give you longer render times.
    You are also leaving zero processors for the rest of your computer. Not a wise idea.
    After effects renders one frame at a time. One HD frame even with multiple layers of pixel processing just isn't that much data. It does take a while to do the calculations, but expecting to have every one of your CPUs jacked up at 100% to render a single frame of video is expecting an awful lot.
    I would suggest that you read up on optimizing After Effects for your computer. Do not expect to be able to utilize 100% of your system resources at all times. That's just not the way processing video on a pixel by pixel basis works.
    Just a little FYI,  for 99% of my projects in After Effects I have render multiple frames simultaneously turned off. It just doesn't work with most of the things I do. Sorry for the disappointment.

  • Multi-thread server with UD32

    Hi
    I have build server with -t for muli-thrread option, it boots fine too. When I
    use UD32 < file. ud it does not work.
    I get following error in ULOG.
    103708.gdev!ProxSvr.26508.4.1: LIBTUX_CAT:6126: INFO: New server dispatched thread
    starting
    103708.gdev!ProxSvr.26508.1.-2: LIBTUX_CAT:476: WARN: Server 3/511: client process
    26500: lost message
    103708.gdev!ProxSvr.26508.1.-2: LIBTUX_CAT:477: WARN: SERVICE=PROXSVC MSG_ID=0
    REASON=server died
    It work when server is not build with -t option.
    Any help ?
    Vijay

    Here's a huge list of SOAP servers:
    http://www.soapware.org/directory/4/implementations
    Here's a SOAP/RMI product called XSOAP that might make more sense for you.
    http://www.extreme.indiana.edu/xgws/xsoap/

  • Multi threaded Server

    Hi all,
    I am not a DBA and don't have DBA acces on my production server. Please let me know how to identify,MTS is enabled on my server or not?
    Also I found this in statspack report
    session pga memory                     7,211,525,400       46,291.5        652.5
    session pga memory max                 9,380,680,064       60,215.6        848.7
    session uga memory                 2,779,758,410,912   17,843,556.3    251,495.4
    session uga memory max                21,093,800,328      135,403.3      1,908.4Can I say 'Session UGA Memory' is high because shared server is used by these sessions?
    Also If MTS is enabled/installed and if I don't give server=dedicated or server=shared in my tnsnames, then that session would use shared connection or dedicated connection?
    I am using oracle 9i rel2
    Thanks in advance,
    Jaggyam

    Hi,
    I am not a DBA and don't have DBA acces on my production server. Please let me know how to identify,MTS is enabled on my server or not?If you can check the init parameter by querying v$parameter then check value for shared_servers, dispatchers. They should be greater than 0
    Can I say 'Session UGA Memory' is high because shared server is used by these sessions?No you cannot.
    Also If MTS is enabled/installed and if I don't give server=dedicated or server=shared in my tnsnames, then that session would use shared connection or dedicated connection? It should use shared connection if possible like availability of dispatchers etc. If it is not possible to connect through shared server then it uses dedicated server.
    Regards
    Anurag Tibrewal

Maybe you are looking for

  • Snooze problem since software update on N95

    I've had my N95 for about 18 months now. I don't use a lot of the things on it, but one I do use is the alarm clock to get me out of bed in time for work. I like to have a bit of "coming around" time so I usually have a few snoozes before getting up.

  • ISO 4 will not install in my 3 year old touch

    I have been trying to install ISO 4 for almost a year.  The process gets stuck on "Backing up Ipod Touch".  I let it go several hours and it didn't progress.

  • Isight camera not working with skype on Win 7 Bootcamp

    So I was happily running windows 7 (need it for work) on my MACBook (mid 2009) with Bootcamp 3.2 until a couple of weeks ago. I updated something (either Skype or Bootcamp, etc) and all of a sudden, my iSight camera takes like 4-5 seconds to initiali

  • How do I change address to one in Spain?

    How do I change my address to one in Spain?

  • How can i hide frm-40401 no changes to save

    hi all, i would like to hide frm-40401 no changes to save i create a (form level trigger/block level) to hide a built in message ON-MESSAGE declare msgnum number := message_code; begin IF msgnum = 40401 THEN Message('my own message.'); end if; end;an