View Javadoc
1   /*
2     (C) Copyright IBM Corp. 2005, 2009
3   
4     THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
5     ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
6     CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
7   
8     You can obtain a current copy of the Eclipse Public License from
9     http://www.opensource.org/licenses/eclipse-1.0.php
10  
11    @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com
12   * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com
13   * 
14   * 
15   * Change History
16   * Flag       Date        Prog         Description
17   *------------------------------------------------------------------------------- 
18   * 1498927    2006-06-01  lupusalex    Fill gaps in logging coverage
19   * 1535756    2006-08-07  lupusalex    Make code warning free
20   * 1565892    2006-11-28  lupusalex    Make SBLIM client JSR48 compliant
21   * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
22   * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
23   */
24  
25  package org.metricshub.wbem.sblim.cimclient.internal.http;
26  
27  /*-
28   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
29   * WBEM Java Client
30   * ჻჻჻჻჻჻
31   * Copyright 2023 - 2025 MetricsHub
32   * ჻჻჻჻჻჻
33   * Licensed under the Apache License, Version 2.0 (the "License");
34   * you may not use this file except in compliance with the License.
35   * You may obtain a copy of the License at
36   *
37   *      http://www.apache.org/licenses/LICENSE-2.0
38   *
39   * Unless required by applicable law or agreed to in writing, software
40   * distributed under the License is distributed on an "AS IS" BASIS,
41   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42   * See the License for the specific language governing permissions and
43   * limitations under the License.
44   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
45   */
46  
47  import java.net.Socket;
48  import org.metricshub.wbem.sblim.cimclient.internal.logging.LogAndTraceBroker;
49  import org.metricshub.wbem.sblim.cimclient.internal.logging.Messages;
50  
51  /**
52   * Class HttpServerWorker forwards incoming connections to a handler
53   *
54   */
55  public class HttpServerWorker implements Runnable {
56  	HttpConnectionHandler iHandler;
57  
58  	Socket iSocket;
59  
60  	/**
61  	 * Ctor.
62  	 *
63  	 * @param pHandler
64  	 *            The handler
65  	 * @param pSocket
66  	 *            The socket
67  	 */
68  	public HttpServerWorker(HttpConnectionHandler pHandler, Socket pSocket) {
69  		this.iHandler = pHandler;
70  		this.iSocket = pSocket;
71  	}
72  
73  	public void run() {
74  		try {
75  			this.iHandler.handleConnection(this.iSocket);
76  		} catch (Exception e) {
77  			LogAndTraceBroker.getBroker().message(Messages.HTTP_HANDLE_CONNECTION_FAILED, e);
78  		}
79  	}
80  }