Problem with fireTableChanged(null)
HI,
I'm developing a little calendar.
My calender is a week calender and shows data from a database.
Every week the data are different.
I want the calendar to skip to another week when I press a button.
All the application works well. The problem is the refresh.
When I push the button, the new table model is rebuilt correctly (I print the correct informations on the console) , but the view of the JTable stays on the old week.
Only if I click on another window of my appl and then return on the calendar the view is updated.
I think there is a problem with fireTableChanged(null) but I don't have well understood how it works.
Can anybody help me?
Thanks
here is a little.
Some more.
Similar Messages
-
RD Gateway 2012 R2 (DMZ) - Problem with authentification (NULL SID)
Hello,
I have a problem with a RD Gateway 2012 R2, that domain users can't log on over the RD Gateway to the RD Sessionhost. I get an error message in the eventlog on the RD Gateway.
Protokollname: Security
Quelle: Microsoft-Windows-Security-Auditing
Datum: 09.12.2014 16:45:24
Ereignis-ID: 4625
Aufgabenkategorie:Anmelden
Ebene: Informationen
Schlüsselwörter:Überwachung gescheitert
Benutzer: Nicht zutreffend
Computer: DMZ2.bptest.local
Beschreibung:
Fehler beim Anmelden eines Kontos.
Antragsteller:
Sicherheits-ID: NULL SID
Kontoname: -
Kontodomäne: -
Anmelde-ID: 0x0
Anmeldetyp: 3
Konto, für das die Anmeldung fehlgeschlagen ist:
Sicherheits-ID: NULL SID
Kontoname: [email protected]
Kontodomäne:
Fehlerinformationen:
Fehlerursache: Bei der Anmeldung ist ein Fehler aufgetreten.
Status: 0xC000005E
Unterstatus:: 0x0
Prozessinformationen:
Aufrufprozess-ID: 0x0
Aufrufprozessname: -
Netzwerkinformationen:
Arbeitsstationsname: SCHULUNG
Quellnetzwerkadresse: -
Quellport: -
Detaillierte Authentifizierungsinformationen:
Anmeldeprozess: NtLmSsp
Authentifizierungspaket: NTLM
Übertragene Dienste: -
Paketname (nur NTLM): -
Schlüssellänge: 0
Dieses Ereignis wird beim Erstellen einer Anmeldesitzung generiert. Es wird auf dem Computer generiert, auf den zugegriffen wurde.
Die Antragstellerfelder geben das Konto auf dem lokalen System an, von dem die Anmeldung angefordert wurde. Dies ist meistens ein Dienst wie der Serverdienst oder ein lokaler Prozess wie "Winlogon.exe" oder "Services.exe".
Das Anmeldetypfeld gibt den jeweiligen Anmeldetyp an. Die häufigsten Typen sind 2 (interaktiv) und 3 (Netzwerk).
Die Felder für die Prozessinformationen geben den Prozess und das Konto an, für die die Anmeldung angefordert wurde.
Die Netzwerkfelder geben die Quelle einer Remoteanmeldeanforderung an. Der Arbeitsstationsname ist nicht immer verfügbar und kann in manchen Fällen leer bleiben.
Die Felder für die Authentifizierungsinformationen enthalten detaillierte Informationen zu dieser speziellen Anmeldeanforderung.
- Die übertragenen Dienste geben an, welche Zwischendienste an der Anmeldeanforderung beteiligt waren.
- Der Paketname gibt das in den NTLM-Protokollen verwendete Unterprotokoll an.
- Die Schlüssellänge gibt die Länge des generierten Sitzungsschlüssels an. Wenn kein Sitzungsschlüssel angefordert wurde, ist dieser Wert 0.
The domain administrator can log on successfully over the RD Gateway. When i log on a domain user on the RD Gateway server console first and then log on over the RD Gateway, the authentication works fine.
The RD Gateway 2012 R2 has been installed as well as the instructions (http://technet.microsoft.com/en-us/library/cc754191.aspx). I have tried a lots of things, but without a result.
e.g.
register NPS in the AD
all ports in the Firewall between LAN and DMZ are opened
set the "Network security: LAN Manager authentication level" to "Send NTLMv2 response only"
re-install of the RD Gateway 2012 R2
Environment:
All machines have Windows Server 2012 R2 or Windows 8/8.1 with the latest updates. All servers are virtualized with Hyper-V.
Domaincontroller (LAN)
RD Sessionhost (LAN)
RD Gateway (DMZ)
Clients (DMZ/WAN)
Hardware-Firewall (3-zone)
Does anyone have an idea, what might be the problem?
Best regards,
BpDkHi,
From your description seems there is user permission issue and that’s the reason you can’t logon to the remote desktop. For this you can I would like to check whether you have done the following steps for troubleshooting.
Need to create RD CAP and RD RAP policies and also add the user under RD CAP properties for proper access. RD CAPs allow you to specify who can connect to an RD Gateway server. You can specify a user group that exists on the local RD Gateway server or in Active
Directory Domain Services. You can also specify other conditions that users must meet to access an RD Gateway server. You can list specific conditions in each RD CAP. For example, you might require a group of users to use a smart card to connect through RD
Gateway.
When there is no AD DS in the perimeter network, ideally the servers in the perimeter network should be in a workgroup, but the RD Gateway server has to be domain-joined because it has to authenticate and authorize corporate domain users and resources.
Please check below article for more troubleshooting and provide access & authenticate user.
RD Gateway deployment in a perimeter network & Firewall rules
http://blogs.msdn.com/b/rds/archive/2009/07/31/rd-gateway-deployment-in-a-perimeter-network-firewall-rules.aspx
Hope it helps!
Thanks.
Dharmesh Solanki
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Problem with /dev/null
Hi,
I faced this problem twice and I do not know how to reproduce it.
There are 2 log files ERRORFILE and EVENTFILE.
I have a script as show below which takes a backup of the log files,every hour. Processes are continously writing to the log files. Occasianaly(twice till now), I see that the inode of the ERRORFILE and EVENTFILE gets changed, due to this no precesses can write to the log file and they need to be restarted to initiate logging. Is there something worng with the command "cp /dev/null".?
TIME=`date '+%Y%m%d_%H%M'`
cp $ERRORFILE $ERRORFILE:$TIME:BACKUP
cp $EVENTFILE $EVENTFILE:$TIME:BACKUP
/usr/bin/gzip $ERRORFILE:$TIME:BACKUP
/usr/bin/gzip $EVENTFILE:$TIME:BACKUP
cp /dev/null $ERRORFILE
cp /dev/null $EVENTFILEHi,
Just to make sure we do not deviate the topic to "/dev/null" getting corrupted.
The actual concern is that the inode of the log files got changed, even though there was no "mv" or "rm" operation performed on it.
The problem for which I need your assistance and expertise is to know whether in any scenario a "cp" will change the inode number, say for example, when we are coping from a device character file(/dev/null). I have pasted the snippet of the script below. Could there be some erroneous condition which could lead to such a problem, say for example gzip returned a error or something like that.
TIME=`date '+%Y%m%d_%H%M'`
cp $ERRORFILE $ERRORFILE:$TIME:BACKUP
cp $EVENTFILE $EVENTFILE:$TIME:BACKUP
/usr/bin/gzip $ERRORFILE:$TIME:BACKUP
/usr/bin/gzip $EVENTFILE:$TIME:BACKUP
cp /dev/null $ERRORFILE
cp /dev/null $EVENTFILEThanks -
N:1 mapping problem with incoming NULL value
Dear experts,
i have a problem mapping an incoming Idoc to XML file. Here's the situation:
1) Structure of inbound Idoc
ZTST00
ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z1", FIELDVALUE = "4";
ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z2", FIELDVALUE = null;
ZTST01 Structure: FIELDNAME, FIELDVALUE, Values: FIELDNAME = "ZABC", FIELDVALUE = "5";
ZTST01 Structure: FIELDNAME, FIELDVALUE. Values: FIELDNAME = "Z4", FIELDVALUE = "6";
ZTST02
2) Resulting XML:
LINEHEADER (1 line)
LINEDETAIL (1 line, Structure: VALUE)
LINEFOOTER (1 line)
3) I need to map ZTST01-FIELDVALUE to LINEDETAIL-VALUE, but only if the FIELDNAME equals "ZABC".
In my message mapping, i put an IF FIELDNAME = 'ZABC' THEN FIELDVALUE->VALUE, on context ZTST00. But because of the null value in line 2 of the Idoc, the value that is returned to the XML is "6", as the null value is disregarded and not in the queue of FIELDVALUE.
How can I put the correct value ("5") to LINEDETAIL-VALUE?
Regards
WilliamHi William,
Simply go back to the default context ZTST01 (for both: FIELDNAME and FIELDVALUE fields) and it should be fine.
Hope this helps,
Greg -
Would someone be able to explain to me the following issue with Iphoto?
I ordered 8 same calendars for my soccer team and received them fine. Although a couple of pictures on it are a little off (out of focus). I need to order two more of the same calendars but when I go thru the process ireceive an error message saying:
"Unable to to assemble calendar" There is a problem with the photo with the file name "(Null)" The full resolution version of this photo either cannot be located or is corrupt. Please replace this photo or delete it from your calendar.
How can I fine this "corrupt" photo? How did it go thru with the first batch of calendars but won't go thru now?
Thank you for your help.Apply the two fixes below in order as needed:
Fix #1
Launch iPhoto with the Command+Option keys held down and rebuild the library.
Since only one option can be run at a time start
with Option #4 and then #1 as needed.
Fix #2
Using iPhoto Library Manager to Rebuild Your iPhoto Library
1 - download iPhoto Library Manager and launch.
2 - click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option.
4 - In the next window name the new library and select the location you want it to be placed.
5 - Click on the Create button.
Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments. However, books, calendars, cards and slideshows will be lost. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
OT -
Problem with QofQ and Null Values
Just converted from CF5 to CF7. Finally figured out what was
causing the error message :
"The value "" cannot be converted to a number" when running a
QofQ. It happens whenever there is a NULL (and I think a ZERO)
value in the QofQ. I'm using the QofQ in a seperate chart program.
The main query merges data from a store and a region table.
I'm doing a LEFT OUTER JOIN to combine the REGION with the STORE,
AND so that stores with NO SALES for a given day will show up as
ZERO. On the main report, when I don't use a QofQWhen grouping by
DAY or MONTH, I can test the value in the CFOUTPUT for NULL or ZERO
and display "0" or "N/A" on the report.
But when I try to chart it, using a QofQ to read in the
values from the main query, and format the numbers, I get this
error message. I've tried using the CAST function, using FLOAT,
DOUBLE, BIGINT, etc., but still get same error message.
The only way I could fix this is to add a WHERE statement to
the QofQ, that only includes sales values greater than ZERO. But
then, I have gaps in my chart because stores with NO SALES for a
given day or MONTH don't appear. Because they are removed from the
query. The whole point of LEFT JOINS is to include items with no
values (or NULL) values.
Does anyone know if it's possible to keep these values in a
QofQ? So that items (e.g., store locations in my case) with NULL or
ZERO values for some or all days or months can be charted? Even
with a ZERO value? I've read everything I can get my hands on
regarding QofQ, the CAST function, etc., but nothing seems to work.
Thanks for any help. (FYI, didn't have this problem with CF5. It's
QofQ could handle NULL or ZERO values without providing an error).
GaryWell, I tried the IsNull function on the 3 SUM() values I was
calculating in my SELECT statement (on a LEFT OUTER JOIN QUERY),
and I STILL got another "cannot convert "" to a number" but this
time the error message was more direct, and pointed me to a DATE
field in my query, where I was SORTING AND GROUPING either by DAY
or MONTH (depending on what user selected on form).
In my QofQ, I'm not just reformating the integer SUM()
values, but also the date values. So, I applied the IsNull()
function to the DATE values in my main query. I still kept getting
errors. But after experimenting ((SQL Server BOL docs doesn't give
ISNULL() examples for DATE FIELDS, only NUMBER fields), I tried
putting the dates in SINGLE QUOTES in my IsNull() function, the
QUERY RAN. Then I wasn't sure WHAT date to enter, e.g., 1/1/1889 or
1/1/2001, etc.
Then, I discovered, after experimenting, that you cannot just
blindly enter ANY date when using IsNull in a date field,
especially if you are using CFGRAPH to chart the results by day.
You have to select a date within the date range the user selected,
so this means using the FORM.DATE (or URL.DATE) value from the
form. Here's the working example from my SELECT main query:
SELECT SUM(ISNULL(d.ttldb,0)) AS SumOfDB,
SUM(ISNULL(d.ttldbv,0)) AS SumOfDBV,
SUM(ISNULL(d.ttldbi,0)) AS SumOfDBI,
<CFIF '#url.reptype#' IS "DAILY">
ISNULL(d.depday, '#url.date1#') AS depday
<CFELSE>
month(ISNULL(d.depday, '#url.date2#')) AS TranMonth,
year(ISNULL(d.depday, '#url.date2#')) AS TranYear
</CFIF>
Then I discovered that whatever date was used in the URL.DATE
field (in my case it would be one of the two date field from the
form, and depended on whether you coded DATE1 or DATE2, the chart
would always show ZERO values for that date. So I tried putting the
IsNull() date values in the GROUP BY and ORDER BY statements, e.g.,
<CFIF '#url.reptype#' IS "DAILY">
GROUP BY ISNULL(d.depday, '#url.date1#')
ORDER BY ISNULL(d.depday, '#url.date1#') DESC
<CFELSE>
GROUP BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
ORDER BY year(ISNULL(d.depday, '#url.date2#')),
month(ISNULL(d.depday, '#url.date2#'))
</CFIF>
And this worked. The report ran just fine, and the chart
charted every value correctly.
I guess you have to learn all the little "quirks" about CF7
and how it's QofQ and chart programs work. But so far, so good.
Thank you all for your help. Now I've got to update other old
CF5 programs that are returning errors when there are null values
from my LEFT OUTER JOIN queries. Will take some time, but at least
I know how to do it. Thanks to your help.
I really appreciate your time and efforts to help with this
issue.
Gary -
How do I find which photo iPhoto is telling me I have a problem with?
I'm trying to buy a book I've formatted, but in place of the filename, it just calls it "(null)".
All of the photos I'm using have names.That same one others seem to have gotten: "Unable to Assemble Book -- There is a problem with the photo with the filename “(null).” The full resolution version of this photo either cannot be located or is corrupt. Please replace this photo or delete it from your book"
I've tried restarting iPhoto with the option and command keys pressed, and asking it to repair permissions, but still have the same message... -
Reflection problems with null pointer exception
I am having a problem with reflection. I keep getting a NullPointerException and can't figure out why.
It is happening when I call this:
ResponseObject result = (ResponseObject)method.invoke(classInstance, argArray);
I can't figure out what the problem is. I had this reflection working, and then I made some changes to how the argument array was created. In the end, the argarray is the same.
Any ideas?Also, the API for the method class says that a
NullPointerException is thrown if the object in the
first argument is null. I have tested for this, and
it is not null.does it? read again, because giving 'null' as the first argument is perfectly legal. how else would you reflectively invoke a static method, since you might not have an actual instance of the class to pass -
Problem with ORA-25240 and msgId:=NULL
Hi,
I have a problem with ORA-25240- the documentation says that you cannot specify a message ID and correlation ID int the dequeue- options. However I am getting it setting msgid explicitely to NULL!
The code snippet is:
vr_message jms_message_with_header_type;
vr_dequeue_options DBMS_AQ.dequeue_options_t;
v_message_handle RAW(16);
BEGIN
vr_dequeue_options.deq_condition := 'tab.user_data.header.properties IS NOT NULL AND '
|| 'tab.user_data.get_string_property('MYServicename'') = '''
|| i_MY_Servicename || '''';
vr_dequeue_options.correlation := i_correlation;
vr_dequeue_options.navigation := DBMS_AQ.FIRST_MESSAGE;
-- should be default anyway:
vr_dequeue_options.msgid:=NULL;
vr_dequeue_options.wait := DBMS_AQ.NO_WAIT;
DBMS_AQ.DEQUEUE
queue_name => 'MYQUEUE',
dequeue_options => vr_dequeue_options,
message_properties => vr_message.header,
payload => vr_message.message,
msgid => v_message_handle
Any ideas?
Thank you,
SteffenHi,
the version is:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for HPUX: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL>
The example behind the link is not complex enough. They are not using deq_condition and correlationId of the deque- options. If I set one of these values to NULL the code works fine but it complains about msgId if I have both values set with msgId=NULL?!?
Thanks,
Steffen -
Absolutely INFURIATING.
I have spent absolute hours building a photo album for the first year or my sons life. Sorting through quite literally thousands and thousands of images. Got a brilliant looking album using 177 of them.
Now everytime I try to check out it won't get past page 1 of building the book.
It says the following "There is a problem with the photo with the filename "null". The full resolution version of this photo either cannot be located or is corrupt. Please replace this photo or delete it from your book.".
The images all look perfect. I have even tried taking them out and re adding the first page images from the library.
Same problem.
This is so annoying. So far I have NOT been happy with this iphoto application having nothing but problems with missing thumbnails. Corrupted images. Things that have never happened to me using a windows machine.Do the filenames contain special characters, like "ä,ü,..." or white space or are the vry long? Is there anything special about the image format? Try to export the edited versions in that case and reimport it with a different, shorter filename.
For testing, create a new book with only the images you want to check.
If this does not fix it, try rebuilding. Depress the option and command keys, launch iPhoto and rebuild the library. -
Message "problem with photo with the filename '(null).
I get the following message "There is a problem with the photo with the filename '(Null).' The full resolution version of this photo either cannot be located or is corrupt. Please replace the photo or delete it from your book." This message appears after place the order and it starts to submit the pages of the book. I get as far as page 9 of 60. I have open the pictures using photoshop and have renamed them and saved them as a tif format. Any suggestions?
annefromtallahassee wrote:
I get the following message "There is a problem with the photo with the filename '(Null).' The full resolution version of this photo either cannot be located or is corrupt. Please replace the photo or delete it from your book." This message appears after place the order and it starts to submit the pages of the book. I get as far as page 9 of 60. I have open the pictures using photoshop and have renamed them and saved them as a tif format. Any suggestions?
I believe that you have gone into the iPhoto library and made changes using photoshop - is that correct
If so then you have trashed your iPhoto library and must put it back exactly as it was - loading a backup is the easiest (probably the only) way
NEVER make any changes to the content or structure of the iPhoto library using the finder or any program that is not fully iPhoto aware
LN -
Problem in summation on a column with possible null values
Hi,
I want to do summation on a column.
If I use <?sum(amount)?>, if there is any null value,its giving NaN as output.
From the forum I got the below syntax
<?sum(AMOUNT[number(.)!='NaN'])?>
but it is also not giving me the expected result. Its always displays 0.
I want some thing like sum(NVL(amount,0)). Could some body please help me out?
Thanks in Advance,
ThiruIf the column has many, many null values, and you want to use the index to identify the rows with non-null values, this is a good thing, as a B*Tree index will not index the nulls at all, so, even though your table may be very large, with many millions of rows, this index will be small and efficient, cause it will only contain index entries for those rows where the column is not null.
Hope that helps,
-Mark -
Problem with Cross-tab report (RTF Template) null values, current-group()
Hi, experts!
I generate Cross-tab report using RTF Tamlpate and I have problem with grouping.
My XML file have to be with one group only because I want to using dynamic regrouping inside the RTF template.
Here is my data structure (XML file):(Look the images for details)
http://img156.imageshack.us/img156/3997/xmlstructureay9.jpg
=======================
WITH GROUPS
=======================
Here is my RTF template:
http://img151.imageshack.us/img151/2951/resultcrosstabbycustomehf8.jpg
When I'm using grouping and I want to have for each group cross-tab report I have the following problem: (Look the images for details)
http://img156.imageshack.us/img156/8786/resultcrosstabbycustomect9.jpg
And this is my code I'm using inside the RTF template with groups:(Look the images for details)
http://img156.imageshack.us/img156/4253/fieldbrowserxb7.jpg
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=======================
WITHOUT GROUPS
=======================
Here is my RTF template:
http://img151.imageshack.us/img151/9545/resultcrosstabwithoutgrzg7.jpg
When I generate one cross-tab there is no problem: (Look the images for details)
http://img156.imageshack.us/img156/7030/resultcrosstabwithoutgrsr1.jpg
This is my code I'm using inside the RTF template WITHOUT groups:(Look the images for details)
http://img151.imageshack.us/img151/7030/fieldbrowserwithoutgrours8.jpg
Can someone give me a hand to deal with this?
Thank you!Pitson,
better to ask this question in the BI Publisher Forum than here in the Oracle Reports Forum:
BI Publisher
Regards
Rainer -
Problem with Threads and a static variable
I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
Code functionality:
A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
The problem as far I understand is:
Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
Thanks,
B.D.
Code:
private static volatile boolean bChanged = false;
private static Thread objMainProcess;
protected static void Init(){
objMainProcess = new Thread() {
public void run() {
while( objMainProcess == Thread.currentThread() ) {
GetState();
objMainProcess.setDaemon( true );
objMainProcess.start();
public static void initStatusTimer(){
if(objTimer == null)
objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
public void actionPerformed( java.awt.event.ActionEvent evt){
SetState();
private static void SetState(){
if( objMainProcess == null ) return;
synchronized( objMainProcess ) {
bChanged = true;
try{
objMainProcess.notify();
}catch( IllegalMonitorStateException e ) {}
private static boolean GetState() {
if( objMainProcess == null ) return false;
synchronized( objMainProcess ) {
if( bChanged) {
SendMessage();
bChanged = false;
return true;
try {
objMainProcess.wait();
}catch( InterruptedException e ) {}
return false;
}Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
Again as you said, There is a reason I can't call sendMessage() inside setState().
The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
Thanks,
B.D. -
Problem with threads running javaw
Hi,
Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
troy.troy,
Try and post a minimum code sample of your app which
does not work.
When using javaw, make sure you redirect the standard
error and standard output streams to file.
Graeme.Hi Graeme,
I dont understand what you mean by redirection to file? some of my code below.
The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
public class Server{
ServerSocket aServerSocket;
Socket dianosticsSocket;
Socket nPortExpress;
ClientListener aClientListener;
LinkedList queue = new LinkedList();
int port = 0;
int clientPort = 0;
String clientName = null;
boolean serverAlive = true;
* Server constructor generates a server
* Socket and then starts a client threads.
* @param aPort socket port of local machine.
public Server(int aPort, String aClientName, int aClientPort){
port = aPort;
clientName = aClientName;
clientPort = aClientPort;
try{
// create a new thread
aServerSocket = new ServerSocket(port) ;
// connect to the nPortExpress
aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
// aClientListener.setDaemon(true);
aClientListener.start();
// start a dianostic port
DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
// System.out.println("Server is running on port " + port + "...");
// System.out.println("Connect to nPort");
catch(Exception e)
// System.out.println("ERROR: Server port " + port + " not available");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
serverAlive = false;
System.exit(1);
while(serverAlive&&aClientListener.hostSocket.isConnected()){
try{
// connect the client
Socket aClient = aServerSocket.accept();
//System.out.println("open client connection");
//System.out.println("client local: "+ aClient.getLocalAddress().toString());
// System.out.println("client localport: "+ aClient.getLocalPort());
// System.out.println("client : "+ aClient.getInetAddress().toString());
// System.out.println("client port: "+ aClient.getLocalPort());
// make a new client thread
ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
// start thread
clientThread.start();
catch(Exception e)
//System.out.println("ERROR: Client connection failure");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
}// end while
} // end constructor Server
void serverExit(){
JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}// end class Server
*** connect to another server
public class ClientListener extends Thread{
InetAddress hostName;
int hostPort;
Socket hostSocket;
BufferedReader in;
PrintWriter out;
boolean loggedIn;
LinkedList queue; // reference to Server queue
Server serverRef; // reference to main server
* ClientListener connects to the host server.
* @param aHostName is the name of the host eg server name or IP address.
* @param aHostPort is a port number of the host.
* @param aLoginName is the users login name.
public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer) // reference to Server queue)
hostName = aHostName;
hostPort = aHostPort;
queue = aQueue;
serverRef = aServer;
// connect to the server
try{
hostSocket = new Socket(hostName, hostPort);
catch(IOException e){
//System.out.println("ERROR: Connection Host Failed");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} // end constructor ClientListener
** multi client connection server
ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
queue = aQueue;
addToQueue(this);
client = aSocket;
clientRef = aClientListener;
aDiagnostic = diagnostics;
} // end constructor ClientWorker
* run method is the main loop of the server program
* in change of handle new client connection as well
* as handle all messages and errors.
public void run(){
boolean alive = true;
String aSubString = "";
in = null;
out = null;
loginName = "";
loggedIn = false;
while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
try{
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
if(aDiagnostic){
out.println("WELCOME to diagnostics");
broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
out.flush();
else {
out.println("WELCOME to Troy's Server");
broadCastDia("Connect : client "+client.getInetAddress().toString());
out.flush();
String line;
while(((line = in.readLine())!= null)){
StringTokenizer aStringToken = new StringTokenizer(line, " ");
if(!aDiagnostic){
broadCastDia(line);
clientRef.sendMessage(line); // send mesage out to netExpress
out.println(line);
out.flush();
else{
if(line.equals("GETIPS"))
getIPs();
else{
clientRef.sendMessage(line); // send mesage out to netExpress
out.println(line);
out.flush();
} // end while
catch(Exception e){
// System.out.println("ERROR:Client Connection reset");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);
try{
if(aDiagnostic){
broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
out.flush();
else {
broadCastDia("Disconnect : client "+client.getInetAddress().toString());
out.flush();
// close the buffers and connection;
in.close();
out.close();
client.close();
// System.out.println("out");
// remove from list
removeThreadQueue(this);
alive = false;
catch(Exception e){
// System.out.println("ERROR: Client Connection reset failure");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);
}// end while
} // end method run
* method run - Generates io stream for communicating with the server and
* starts the client gui. Run also parses the input commands from the server.
public void run(){
boolean alive = true;
try{
// begin to life the gui
// aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
// aGuiClient.show();
in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
while (alive && hostSocket.isConnected()){
String line;
while(((line = in.readLine())!= null)){
System.out.println(line);
broadCast(line);
} // end while
} // end while
catch(Exception e){
// System.out.println("ERRORa Connection to host reset");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
try{
hostSocket.close();
}catch(Exception a){
JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
alive = false;
System.exit(1);
} // end method run
Maybe you are looking for
-
One of the web masters at my school has embedded several Captivate 5 swf files in a web page. I had re-exported all of them to not auto start after we realized that the originals were set to auto play upon loading (someone else made the orginials...
-
Transaction between MS SQL 6.5 and Oracle 8.1.x possible?
Hi all! I'm rather new to BEA products. Our company (DaimlerChrysler subsidary) evaluates application server products and transaction monitors for a governmental customer in Germany. Will it be possible only with WebLogi
-
Table control in module program
hi, i don't know about table control in module program.so please send the faq's ?
-
Resource Pool "Observer" - how failover works in SCOM 2012
We currently have 5 Management Servers SCOM 2012 SP1 Cu6 + a SQL Failover Cluster for SQL database of SCOM/SCOMDW. 2 of these Management Servers are dedicated for network monitoring of approximately 200-400 network devices (including certified and ge
-
MacBook Pro won't start after being powered off for extended period of time
Hi all, I have a 2013 MacBook Pro (OS X Mountain Lion) that I've owned for about fourteen months. I have just been away for several weeks, during which time my computer has been left completely powered down. However, now it will not start up again.