Posts

Showing posts from December, 2007

Difference between volatile and synchronized

volatile is a field modifier, while synchronized modifies code blocks and methods. So we can specify three variations of a simple accessor using those two keywords: int i1; int geti1() {return i1;} volatile int i2; int geti2() {return i2;} int i3; synchronized int geti3() {return i3;} geti1() accesses the value currently stored in i1 in the current thread . Threads can have local copies of variables, and the data does not have to be the same as the data held in other threads. In particular, another thread may have updated i1 in it's thread, but the value in the current thread could be different from that updated value. In fact Java has the idea of a "main" memory, and this is the memory that holds the current "correct" value for variables. Threads can have their own copy of data for variables, and the thread copy can be different from the "main" memory. So in fact, it is possible for the "main"

How To Change Port Of Jboss

Image
With default configurations, JBoss listens on port 8080 for web connections. But this can be changed easily as this port is defined in an configuration xml file. This is how port 8080 is changed on JBoss 4. 1. Goto the deploy folder of the server instance you use. 2. Goto the jbossweb-tomcat55.sar inside that deploy folder. 3. Find the file named server.xml inside that folder. (tomcat service file). Look for the HTTP Connector section inside the server.xml where 8080 configuration is available. Change the port value to what ever the required port number. Connector port= "8080" address="${jboss.bind.address}" maxThreads="250" strategy="ms" maxHttpHeaderSize="8192" emptySessionPath="true" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"

What is the difference between an application server and a Web server

A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols. Web server's delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging. A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page. To process a request, a Web server may respond with a static HTML page or image, send a redirect, or delegate the dynamic response generation to some other program such as CGI scrip

What is Serialization

Serialization is the process of persisting the state of an object. Lets say for example you create a dog object and instantiate all its various members, size, age, height etc. Serialization allows you to 'save' this object persisting all its state. Its kind of like saving anything, this can then be restored at a later date and the object reused. To make a class suitable for serialization the class needs to implement the Serializable interface. Serializable is a marker interface, it doesnot have any methods defined.