Synchronization probleam
2 Answer(s)      8 years ago
Posted in : Java Server Faces Questions


View Answers

December 31, 2008 at 5:25 AM

Hi friend,

Plz give source code of "" to solve the probelm and visit to :


January 2, 2009 at 4:04 AM

Hi friend,

I saw your sending code but i does not found your importing file

import vechile file please send me code and explain in detail.

import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
//import vechile.*;

class ClientWorker implements Runnable {
private Socket client;
private JTextArea textArea;

ClientWorker(Socket client, JTextArea textArea) {
this.client = client;
this.textArea = textArea;

public void run(){

String line=new String();;
BufferedReader in = null;
PrintWriter out = null;
//vechile.parsestring1 ps = new vechile.parsestring1();
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
out = new PrintWriter(client.getOutputStream(), true);

catch (IOException e) {
System.out.println("in or out failed");

line = in.readLine();
if(line != ""){
catch (IOException e) {
System.out.println("Read failed" + e);

FileWriter fstream = new FileWriter("amar.txt",true);
BufferedWriter out1 = new BufferedWriter(fstream);
catch (Exception e){
System.err.println("Error: " + e.getMessage());
catch(Exception e){
System.out.println("Error while writing to db"+e);

class SocketThrdServer extends JFrame{

JLabel label = new JLabel("Text received over socket:");
JPanel panel;
JTextArea textArea = new JTextArea();
ServerSocket server = null;

SocketThrdServer(){ //Begin Constructor
panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("North", label);
panel.add("Center", textArea);
JScrollPane scrollingArea = new JScrollPane(textArea);

// Get the content pane, set layout, add to center
Container content = this.getContentPane();
content.setLayout(new BorderLayout());
content.add(scrollingArea, BorderLayout.CENTER);
} //End Constructor

public void listenSocket(){
server = new ServerSocket(8080);
catch (IOException e) {
System.out.println("Could not listen on port 8080");
ClientWorker w;
w = new ClientWorker(server.accept(), textArea);
Thread t = new Thread(w);
}catch(InterruptedException IE){
} catch (IOException e) {
System.out.println("Accept failed: 8080");

protected void finalize(){
} catch (IOException e) {
System.out.println("Could not close socket");

public static void main(String[] args){
SocketThrdServer frame = new SocketThrdServer();
frame.setTitle("Server Program");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {



Related Tutorials/Questions & Answers:
Synchronization probleam - Java Server Faces Questions
Synchronization probleam  Hi friend my question is why it is consuming 99% of cpu time. if i discarded that vechile package it doesnt affect the programme Here is the new code please tell me how to synchronize
Synchronization probleam - Java Server Faces Questions
Synchronization probleam   Hi friends My java multithreading listner consumes 99% of cpu time.please tell me how to synchronize this programme so that it runs normally like any other programmes. Here is my code
Synchronization  what is the use of synchronization
synchronization  what is about static method synchronization&instance method synchronization
Synchronization  i want code for synchronization using in jsp and servlets
Synchronization and interlocking
Synchronization and interlocking  What are the different level locking using the synchronization keyword
java synchronization
java synchronization   What is synchronization and why is it important
Synchronization      ... consistency errors. By the synchronization tool we can avoid this problem. In other.... Remember the following points related to lock and synchronization: Only
Java Synchronization
Java Synchronization  What is synchronization and why is it important?  Synchronization is best use with the Multi-Threading in Java. Synchronization is the way to make our program safe. As we know when we have two
Java synchronization
Java synchronization  What is synchronization and why is it important?  Synchronization is best use with the Multi-Threading in Java. Synchronization is the way to make our program safe. As we know when we have two
Synchronization on threads
Synchronization on threads  what is the difference between synchronized method and block??   Hello Friend, Differences: 1)Synchronized blocks place locks for shorter periods than synchronized methods. 2)Synchronized
Synchronization and Singlethreadmodel - Java Beginners
Synchronization and Singlethreadmodel   Hi Deepak, wat is d difference between singleThreadmodel and synchronization. Thank u in advance
Describe synchronization in respect to multithreading.
Describe synchronization in respect to multithreading.  Hi, Describe synchronization in respect to multithreading. thanks,   Are you... the synchronization in respect to multithreading
Synchronization - Java Interview Questions
Synchronization  Dear Sir my doubt is If we cannot use synchronization for a class then how a vector class is called as synchronized
difference between lock and synchronization
difference between lock and synchronization  Hi, I am new in java please anyone tell me difference between lock and synchronization in java. its... and Synchronization
Synchronization with Multithreading - Java Beginners
Synchronization with Multithreading   Hi Deepak, what i know abt synchronization is , we can implement synchronized keyword..., Synchronization : Two or more threads share the same resource (variable or method
Synchronization in cluster - Development process
Synchronization in cluster  I have a scenario to implement. we have....  Hi, Synchronization is a process of controlling the access... is in the process of using or updating the object's value. Synchronization prevents
Synchronization in java with example
Synchronization in java with example In this section we will discuss about Synchronization in java. Since java is a multi-threaded language so, when two... at a time and the process by which synchronization is achieved is called
Thread Synchronization in Java
Thread Synchronization in Java Sometimes, when two or more threads need shared... as thread synchronization. The thread synchronization is achieved through... to be synchronized } Object in Java which have synchronization block
how the streams provide synchronization - Java Beginners
how the streams provide synchronization  How the java streams provides synchronization
Java :Thread Synchronization
Java :Thread Synchronization This section explains how to use concept of synchronization in java Thread. Thread Synchronization : . Java supports multi... of program. So for the multi-threaded application, synchronization of java
SubText Plugin
and handling, synchronization, context-sensitive behavior, performance optimizations
collections  what is meant by synchronization
collections  what is meant by synchronization
jsp drop down without refresh - JSP-Servlet
jsp drop down without refresh  Sir I have tried two depenedent jsp dropdown in jsp page,But the probleam is when i select first drop down its... jsp same probleam also arise. Please tell me how to use the drop down without
jsp dropdown refresh - JSP-Servlet
jsp dropdown refresh  Sir Thank u for your jsp code for dependent dropdown list, i used it in different table for data extraction but the probleam during data extraction when i select first drop down its refresh then 2nd
Java Code - Java Beginners
variables.  Hi I hope it solves ur probleam import*; class
Java Code - Java Beginners
probleam import*; class Double { public static void main(String