Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8636539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:15:10+00:00 2026-06-12T10:15:10+00:00

I was wondering if it was possible to disable socket connection pooling in JAX-WS?

  • 0

I was wondering if it was possible to disable socket connection pooling in JAX-WS?

I am making calls to a webservice from within Jetty. The webservice is designed to have at most two connections to the server at any given time. One of the connections is a blocking connection that’s used to do a pub/sub poll with the server. The other connection is used to make standard SOAP requests. Once a connection polls, no other connections can be used to poll, or the server returns an error.

To do this, I create two SOAP ports, one of which I use to poll and the other to make requests. This works great until the poller returns some data and the SOAP request connection is sitting there idle. When that happens, the next time I try to poll with the same SOAP port, it picks one of the connections out of the connection pool and reuses it. If it happens to get the SOAP request connection, the server returns an error. From that point on, the poller’s dead in the water, since any new SOAP ports I create end up reusing one of those two connections, both of which have been deemed invalid for polling.

A possible solution would be to disable connection pooling, which means that each time I create a new SOAP port, it would establish a new connection. Either that, or a way to get at the socket itself, which I could forcefully close.

It might also be worth mentioning that the connection to the server is a mutually authenticated SSL connection.

FYI, here’s the spec for the server that I’m trying to connect to:

http://www.trustedcomputinggroup.org/files/resource_files/93C23F2A-1A4B-B294-D0A36CCD8A9E7BD3/TNC_IFMAP_v2_0R0_47.pdf

Any help would be appreciated! Thanks, Marshall

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:15:11+00:00Added an answer on June 12, 2026 at 10:15 am

    I discovered a work-around solution to my problem after trying lots of different things. Unfortunately, I wasn’t able to figure out how to disable connection pooling. If anyone knows how to do that, I’d like to hear the solution.

    I ended up creating my own custom SSL socket factory that acts as a pass-through to the default SSL socket factory, which I set on the HttpsURLConnection class:

    SSLContext context = SSLContext.getInstance("TLS");
    context.init(new KeyManager[] { new ClientKeyManager() }, 
        new TrustManager[] { new ClientTrustManager() }, 
        new SecureRandom());
    HttpsURLConnection.setDefaultSSLSocketFactory(new ManagedSSLSocketFactory(context.getSocketFactory()));
    

    Note that I pass in the default socket factory from the SSLContext class. The code for the ManagedSSLSocketFactory looks like this:

    private class ManagedSSLSocketFactory extends SSLSocketFactory
    {
        private SSLSocketFactory m_socketFactory;
    
        public ManagedSSLSocketFactory(SSLSocketFactory socketFactory)
        {
            m_socketFactory = socketFactory;
        }
    
        @Override
        public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException
        {
            Socket socket = m_socketFactory.createSocket(s, host, port, autoClose);
    
            //Note that m_arcThread, m_arcSocket, etc are defined in the containing class
            if(Thread.currentThread() == m_arcThread)
            {
                if(m_arcSocketInvalid || (socket == m_ssrcSocket))
                {
                    closeSocketQuietly(socket);
                    return createSocket(s, host, port, autoClose);
                }
                m_arcSocketInvalid = false;
            }
    
            ... omitted some convoluted code that deals with edge cases
    
            return socket;
        }
    
        ... rest of implementation
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering is it possible to build CLI app that can be run from
I am wondering if its possible to have a an (||)or or (&&)and operator
I was wondering if its possible to directly cast objects within a foreach loop.
I have not worked so much with files: I am wondering about possible issues
I was wondering if it's possible to use .NET to disable a certain network
I am wondering if it's possible to restore dropdown values once they have been
Wondering if its possible to communication from javascript to flash without the use of
just wondering if its possible to have a hidden parent and a visible child
I'm wondering if it's possible for a script to enable/disable all input elements on
I was wondering if it is possible to have a button inside a groupbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.