|
About the only problem I can see is two computers starting software at about the same time. This produces a wait of three seconds of about the same time, network delays could make up for less than a second startup time. This may not be a problem as long as not tasks are started by autoscript.
I prefer a change in serverRunning to provide tertiary:
serverRunning
{
RequestServerIdentification
ListenForServer
if (replyfrom server) return true; // server online
RequestToBecomeServer
if (replyfrom server) return true; // deny server role, server online
VerifyServerRole
if (replyfrom server) return true; // deny server role, server online
}
It's somewhat overkill for most projects, however it also allows extension to design. For instance in a very important application you may want redundant networks with redundant servers. So one machine could be server on one network, another machine on the second network, all machines tie to both networks. This design allows you to make decisions based on that by validating server role by network. Even if a server exists on one network the server can ignore the request for server info on the other network thus allowing another machine to become server for that network. Once coded it's pretty easy to put logic in each decision process, and you have a double check in case one computer becomes the server while the other is going through the process. Time tagging time up in the message means that others receiving a time-online message longer than theirs drop out of the running for server, they see multiple machines vying for the server role and simply say a server exists because they see other clients trying to be promoted to server.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Yeah! I like that idea. Giving it a go now. Thanks for the advice that seems like a good way to go.
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
code-frog wrote:
Yeah! I like that idea. Giving it a go now.
One other case you may consider, or not depending on app. I do redundant systems often, so the concept of computer failure is always on my mind.
Think on this scenerio:
You have a server, all is well.
Server machine dies, and comes back, this design allows it to return to being the server.
But what if the machine does not return. All clients are on the network, no one is the server. Do you declare the oldest client app as server afer x amount of time without a server?
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
This would actually be a requirement for what I'm trying to do. I do need a very redundant system and as each instance of the program will have a full copy of data from the current server any one of them could become the server then there would not be any data loss. The only impact would be expiring old server and promoting new server.
Using a timestamp for each client is a convenient way to establish leadership in the event of a missing server.
I figure I can manage everything in a timer event and then nest some loop processing. I want all the objects to be able to send a broadcast message that they are shutting down. There's no reason for the other systems to have to test for a missing server/client if it's not necessary. If the machine is being rebooted I have time to notify everyone. If the connection is lost then fault tolerance in clients will behave appropriately based on well test assumptions in the code.
//results = value returned from socket. Results is empty or not.
//resume = we have found old server or promoted new server now just keep listening as client or pumping if server.
//Program loads
()
//Timer Event that manages state of object.
{
If(results)
{
// stay as client
}
else
{
//We have missing results
loop->
{
//listen for server
}
}
if (serverFound)
{
//resume
}
else
{
//Promote oldest to new server.
//resume
}
}
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
Java? sounds like an extinct animal or something - its on WWF
~Alexander Kent
|
|
|
|
|
I think it's on tour with Vanilla Ice or was it... Milli Vanilli? Hmm, don't remember.
I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len
Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.
|
|
|
|
|
I know not many people are on this board, but I am trying to save a JTree to a database and am having a hard time trying to figure this one out. I was thinking of using arbitrary numbers to identify the parent node however I am struggling with this. Has anyone had any experience with this before? If so what were your solutions?
Thanks!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I see no one really reads this still, but I was hoping a few people may see it. Anyway I am still working on saving a DefaultMutableTreeNode to the database and am having a tough time iterating through the tree. I am trying to write a recursive method to do so. Is this the correct way to do this and if anyone can try and show me an example that would be great! Thanks again!!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I don´t tried this in real. But if you put a DefaultTableModel behinde the Jtabel. Than you can modify the Model and get a [][] of strings ( I think), this might help.
|
|
|
|
|
I was wondering if anyone knew of some good open-source/free jar files. I am looking for things like graphs, tables etc.
Thanks!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
|
Ok..just wondering if anyone else has run into this problem. At work we are building return url's to send to different apps. For this we use MessageFormat.format. for example
l_url = MessageFormat.format(<br />
l_url,<br />
new Object[] {<br />
"fooProcessing?foo=true",<br />
getUrlInfo(),<br />
getDeployment(),<br />
l_userId,<br />
l_returnJsp});
In this example, l_userId is of the object type Integer. Now, lets say for a moment that my userId is 1011. Now when I call the toString() function I get returned "1011". The MessageFormat.format however is somehow formatting l_userId to be "1,011." Which as you guessed, totally blew up our return urls, as when we go to convert that userId to an Integer, it doesn't like the commas. My question is, why did it do this? Shouldn't this just call a simple toString() implicitly as we are inserting them into a string? Another question I have is, if Integer can format that way (with the comma) why can't it take a number with commas in it when creating a new Integer?
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|
Hey,
Well I figure I would post a question here becuase well I need an answer and no one ever posts here! I am sure this is a simple question but here goes. I am using the method startsWith that is a part of the String class and in the api it says that this will return true if an empty string is passed to the method. This is diffently not ok for what I am doing so I was wondering I would test for an empty string? Do I just do stringName.equals("") == true? Is there a solid way for me to test for this? Thanks for all of your help...well those that check this board!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
|
I was all excited that this bored may have started up again. I guess no one here really cares about java oh well. Atleast I know that 2 people check it
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
BrockVnm wrote:
I guess no one here really cares about java
<paranoid>
Maybe Chris couldn't get a sponsor deal with Microsoft if he didn't close down the board?
</paranoid>
What puzzles me, is that there is still a Java Article Forum.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
|
Hey,
I have a module that I have built that has uses swing. It has a table, an input panel and a bunch of buttons to do a few different tasks. The table is populated from the database and when the user enters his input vaules a column in the table gets populated. Now I have a button the user presses to print a report, a button the user presses to email his report and a user asked me to have a button that would just launch the email with the data dumped into the body of the email. So I have extracted the data and stored it into a StringBuffer. I have the data formated with tabs and returns. Now I am not sure how to lauch the default mail client. I tried doing it like so but it did not work because 1 my data was larger than 1K and 2 it does not support my tabs and returns:
cmd /c start \"\" \"mailto:?subject=test&body=" + body + "\""
Is there any way I can launch the default mail program and have my data dumped into the body of the email?
Thanks for all of your help! I have spent 2 days trying to figure this out and its driving me nutts!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
An applet can open the mail application like that:
getAppletContext().showDocument("mailto:me@me.net?subject=test&body=text");
An application should be able to do the same by writing the email and the SMTP headers into a .eml-file and then launching the file with the default application:
cmd /c start tmpFileName.eml
_________________________________
Please inform me about my English mistakes, I still try to learn your language!
|
|
|
|
|
How do I create the eml file? Is this easy to create?
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
Launch your default mail application, and save a mail to a file. The result is an eml file. It contains headers and text, and can be read by other mail applications.
For example, this is the eml file of a CP notification mail:
Return-Path: <forums@codeproject.com>
Delivery-Date: Tue, 19 Apr 2005 18:30:32 +0200
Received: from [209.171.52.98] (helo=mail1.codeproject.com)
by mxeu4.kundenserver.de with ESMTP (Nemesis),
id 0MKqlY-1DNvcN2ar0-0003MW; Tue, 19 Apr 2005 18:30:31 +0200
Received: from mail.codeproject.com [192.168.5.58] by mail1.codeproject.com
(SMTPD32-7.15) id A07014C006C; Tue, 19 Apr 2005 12:23:12 -0400
From: "BrockVnm" <forums@codeproject.com>
To: "Corinna John" <cp@binary-universe.net>
Subject: [CodeProject] Re: Launching default Mail application
Date: Tue, 19 Apr 2005 12:23:13 -0400
X-Mailer: Dundas Mailer Control 1.0
Organization: The Code Project - http:
Message-Id: <200504191223155.SM01040@mail.codeproject.com>
Envelope-To: webmaster@binary-universe.de
*** DO NOT REPLY TO THIS MESSAGE ***
This message has been sent from an unattended email box. The actual
reply address can be found below.
You don't need the delivery fields, this should be enough:
From: "BrockVnm" <forums@codeproject.com>
To: "Corinna John" <cp@binary-universe.net>
Subject: Your Subject Goes Here
Date: Tue, 19 Apr 2005 12:23:13 -0400
Your Text Goes Here
_________________________________
Please inform me about my English mistakes, I still try to learn your language!
|
|
|
|
|
I copied the above and put them in a file called test.eml and it launched outlook express. I am currently using Microsoft Outlook so it has to open in regular Outlook. Is this still possible?
Thanks for all of your help!!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I guess the .eml files are associated to the default mail client, so it should be ok.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
My default mail client is Microsoft Outlook and the eml file that is opening in Outlook Express. I think the eml file may be an Outlook Express file. I have been trying to save the file as a .msg, .oft or .rtf file but they are not opening in Outlook. I am not sure of the format. I hope there is a nother option
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
Does creating a MimeMessage make this any easier?
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|