Hello all,
I am struggling with a decision. I am writing a thread-safe library/API. Listeners can be registered, so the client is notified when something interesting happens. Which of the two implementations is most common?
class MyModule {
protected Listener listener;
protected void somethingHappens() {
synchronized(th...
Hi,
I have made a java application of a 4 way junction. I can to move all the cars across the junction using THread.sleep() but I need to make the cars not crash into one another. (See diagram)
What should I use ?
Synchronization
wait()/notify()/notifyAll()
ThreadPanels
Canvas (btw what is Canvas and its purpose ?)
I have used l...
If I have several mutable properties in an object that will be acted upon by several threads, I understand they should be synchronized.
class Doggie {
private String name;
private int age;
public void setName(String name) { this.name = name; }
public String getName() { return this.name; }
public void setAge(int a...
In Kylix TEvent.WaitFor(Timeout) method only accepts Timeout of $FFFFFFFF, otherwise it generates an error. Internally it uses sem_wait function which doesn't have a timeout parameter. It there any way around this? I need to set a timeout parameter.
...
I'm just reading a bit into JavaScript and came over some code that handle the process of loading images:
var n = 0;
...
for (...) {
...
image[i].onload = function { n++; };
}
Is this piece of code safe or can there be any type of race while accessing the variable n?
...
I have an object whose internal mutable state is being constantly updated by one or more threads. The object is synchronized, and the goal is to periodically save its state (via serialization) from yet another thread:
public class Counter implements Serializable {
private int dogCount;
private int catCount;
public synchron...
.
Hi,
We are building an ASP.NET application (with C#.net as language) and will be hosting on Windows Server 2003 Operating System. The server will be at USA.
The problem here is that, we need to synchronize the server time with it’s current USA time zone. That mean we are thinking of automated time synchronization (without any human...
This is a followup question to: http://stackoverflow.com/questions/3077703/java-serialization-of-objects-in-a-multithreaded-environment.
Suppose I have a collection of objects that are always acted upon by multiple threads.
public class AlwaysChanging implements Serializable {
// ... state ...
public synchronized void updateFr...
Since use of isolatedstorage storing for silverlight can provide a method for storing userdata locally and whikle not connected to the internet, I'm interested in hearing your thoughts about intelligently synchronizing dbdata and silverlight isolatedstoragedata.
I've currently implemented a solution, but it seems a bit complex to me, so...
I've got a client who has a very large internal system using Access, which is used internally to handle virtually all company data. They want a web front-end to the customer data in that database, and would be running on a different server. Given the limitations on Access, the front-end would likely use MySQL.
Which leaves the issue o...
MSDN documentation suggests that there may be other ways of using ExitContext flag. See WaitHandle.WaitOne() What other ways are there to enter a non-default context outside of using a ContextBoundObject inherited class? (I can't use ContextBoundObject in my application)
...
What are the advantages and disadvantages of PEP vs COLA as Eclipse pairing plugins?
...
Hi. I have a class like this:
public class Utils {
public static void doSomething() {
// doSomething code
}
public static void doSomethingElse() {
// doSomethingElse code
}
}
I want the two methods to be synchronized but not synchronized against each other i.e. no two threads can process the doSomethi...
WaitHandle.WaitOne() has an ExitContext option to allow for temporary release of a resource lock before holding for another. This is useful in some cases where dead-lock or thread starvation may occur.
The msdn documentaiton talks about a dondefault context. They only refer to examples which constitutes being in a nondefault context i...
I've learned that every class byte code is been loaded to the memory once for each class loader, thus when a thread is executing the byte code of some method, and another thread comes along?
1 thread -> 1 instance - of class Foo == no problem.
X threads -> 1 instance - of class Foo == need to be handled this is clear.
X threads ->...
In a nice article with some concurrency tips, an example was optimized to the following lines:
double getBalance() {
Account acct = verify(name, password);
synchronized(acct) { return acct.balance; }
}
If I understand that correctly, the point of the synchronization is to ensure that the value of acct.balance that are read by ...
I have a web application that relies on a MySQL database, for which I am thinking of building an iPhone app. This app would allow users to browse/insert/update/delete data on their account on the web application.
The easiest way would be to build the iPhone app simply as an interface for the web app, ie each operation requires to be con...
Hello,
I am learning the ropes of Microsoft Sync Framework, and have a question.
For the sake of simplicity, let's say I have a table called [Project] in SQL Server with the following structure:
[Project].[ProjectId] (PK, UID)
[Project].[Name] (varchar)
[Project].[Leader] (varchar)
I create an Scope called 'filtered_proj...
I need to develop a file synchronization application to sync my files from my local computer to my remote server. My local OS is windows and remote OS is Unix. I can access files on the remote on FTP.
Is file's 'modified date' enough to find out files that has been changed on my computer?
...
There is a button "Upload All Outgoing Changes" in Synchronize panel of eclipse. Any way to "click" it without mouse? There is no such action in prefs->general->keys
...