synchronization

Why the name "monitor"?

I'm referring to monitors as described here: http://en.wikipedia.org/wiki/Monitor_(synchronization) None of the definitions here seem apropos: http://www.thefreedictionary.com/monitor So why are they called that? == Update == Thank you for the answers, everyone! I guess I was confused because I don't think of monitors usually as a...

How do synchronized static methods work in Java?

If I have a util class with static methods that will call hibernate functions to accomplish basic data access. I am wondering if making the method synchronized is the right approach to ensure thread-safety. I want this to prevent access of info to the same DB instance. However, I'm now sure if the following code are preventing getObject...

How do I get my Threads to not block one another?

I have 2 Threads, one that's polling a mailbox for messages then sleeping while (!quit) and another that's supposed to change the quit flag should the user enter 'Q'. It seems that the scanning Thread blocks the other Thread from executing until there's some input (usually 2 lines). I've tried changing the priority of the Threads and the...

SQLite synchronization when accessed by applications on different machines

I'm wondering how SQLite implements it. Is it based on file-locking? Surely the entire DB isn't locked for every user that accesses it; that would be extremely inefficient. Is it based on multiple files or just one big file? Would be nice if someone could give a short overview of how synchronization and locking is done in sqlite, or, o...

Is the 'synchronized' keyword in a classic enterprise application suspicious?

I am talking about classic enterprise applications. Typically hosted in some kind of application-server or container. Nothing fancy, just entities, services, Presentation/UI and relational storage. Whenever I see the synchronized keyword (either on methods or for blocks) in such an application I get very suspicious. In my opinion this i...

How to synchronize media playback over an unreliable network?

I wish I could play music or video on one computer, and have a second computer playing the same media, synchronized. As in, I can hear both computers' speakers at the same time, and it doesn't sound funny. I want to do this over Wi-Fi, which is slightly unreliable. Algorithmically, what's the best approach to this problem? EDIT 1 Wh...

IMAP folder/messages synchronization strategy?

I'm about to add IMAP email integration to one of our web applications (ASP.NET / SQL Server). I'm already using a commercial library which exposes the most important IMAP functionality: get folder list, get message headers, get mime message etc.) Getting email data "live" from the IMAP server works very well. But here comes the difficu...

How to have partial incremental synchronizations based on a GUID?

I need to synchronize an SQL Server database to Oracle through an Oracle Transparent Gateway. The synchronization is performed in batches, so I need to get the next set of data from the point where I left off. The problem I'm having is that the only field I have in the source, to help me, is a GUID. If it were a number I could just orde...

What is the best way/tool to synchronize two MySql servers (not in the same cluster).

I find myself develop apps in my home, which then, on the commercial server are filled with data. I need a simple and easy way to dump a MySql DB from the commercial server into my private one. Is there a tool/command to do this? (I thought about making my DB a slave, but then, I don't always have the permissions to touch the commercial ...

Synchronization for multiple readers, single writer?

Another synchronization question...I hope you guys don't get annoyed ;) Assume the following scenario: one central data structure (very large, so I don't really want to make it immutable and copy it around whenever a change occurs. I even don't want to keep multiple copies in memory), multiple reader threads that access that data struct...

How can i synchronize two database tables with PHP?

I need to use PHP to copy data from one MySQL database to another. I can build and array of all the values to go into the other database but first I want to make sure the database has the correct fields before inserting. For example say I am going to be copying data from tableA to tableB. I can set up tableB to look just like table...

Svn Repo Syncing

I would like to keep a copy of a 3rd parties code in my SVN repo. (so I can run reports and tests) How could I sync a certain folder / path from their repo into mine? Obviously I can't just do an export from their repo and commit to mine because this would miss deletes. Extra cool points for an automated solution. svn:externals could...

Keeping testing and production server environments clean, in sync, and consistent

It seems that the company that I work for is always struggling with our customers’ server environments. Specifically, we almost always encounter problems with testing servers and production servers, and the fact that they always seem to be configured differently. When we test the applications that we develop, the testing servers behave ...

Static fields in an ASP.NET Webservice

Is a static variable in a webservice shared between all running invocations of the webservice on a server? In my case I want a server-wide sync-lock, and I beleive I can accomplish that with a single private static Object syncHandle = new Object(); Is that correct? ...

Synchronizing file system, how to detect if a file has changed?

Hi, I have the needs to write a simple backup component to synchronize a folder and its sub folders to a server. For incremental backup I only want to upload the changed files. What would be the best way to track the changes in the file system? Some existing software like tortoisesvn and office groove have such capability to detect file ...

Synchronising data entities from different applications

I'm looking for some feedback on the best approach to a problem I've been tasked with. There are two systems with their own databases which store very similar business entities. For each entity in question there needs to be a synchronization mechanism in place to make sure that changes in one database are delivered to the other when a ...

Wanted: Cross-process synch that doesn't suffer from AbandonedMutexException

I have several threads that acquire Mutexes and then terminate. The mutexes are stored in a main repository, and are properly released when the program exists. However, when the thread that allocated a Mutex exists, the mutex gets released automatically, and subsequent acquire AbandonedMutexException (also according to the documentation...

Logging and Synchronization

I have just written my own logging framework (very lightweight, no need for a big logging framework). It consists of an interface ILogger and a number of classes implementing that interface. The one I have a question about is TGUILogger which takes a TStrings as the logging target and synchronizes the logging with the main thread so that...

Do I need to Dispose() or Close() an EventWaitHandle?

If I am using EventWaitHandle (or AutoResetEvent, ManualResetEvent) to synchronise between threads then do I need to call the Close() or Dispose() methods on that event handle when I am done with it? EventWaitHandle inherits from WaitHandle, which implements IDisposable. And FxCop complains if I don't implement IDisposable on any class ...

Synchronizing on an Integer value

Suppose I want to lock based on an integer id value. In this case, there's a function that pulls a value from a cache and does a fairly expensive retrieve/store into the cache if the value isn't there. The existing code isn't synchronized and could potentially trigger multiple retrieve/store operations: //psuedocode public Page getPa...