Questions tagged [locks]

A lock generally refers to something that prevents another process from starting or accessing the same information until the lock is released. Use with an appropriate language tag. Do not use for physical locks.

433 questions
5
votes
1 answer

Understanding jpa locks vs transaction isolation levels

I'm trying to understand the relationship between this concepts. Does the jpa locks is the way to provide/call transaction isolation level in DB from java? Or is it separated mechanisms, so what is the difference (their purposes)?
Alex Silkovsky
  • 541
  • 5
  • 18
5
votes
1 answer

How to implement multithreaded access to file-based queue in bash script

I have a bit of a problem with designing a multiprocessed bash script that goes trough websites, follows found links and does some processing on every new page (it actually gathers email addresses but that's an unimportant detail to the…
Petrroll
  • 741
  • 7
  • 29
5
votes
1 answer

MongoDB Write and lock processes

I've been read a lot about MongoDB recently, but one topic I can't find any clear material on, is how data is written to the journal and oplog. So this is what I understand of the process so far, please correct me where I'm wrong A client connect…
user1678745
5
votes
2 answers

Lock on table while inserting data in SQL Server database

I have question on lock on table in SQL Server while inserting data using multiple processes at a single time into same table. Here are my questions on this, Is it default behavior of SQL server to lock table while doing insert? if yes to Q1, then…
user2986108
  • 95
  • 1
  • 2
  • 7
5
votes
5 answers

Thread safe implementation for Hash Map

First, I'll describe what I want and then I'll elaborate on the possibilities I am considering. I don't know which is the best so I want some help. I have a hash map on which I do read and write operations from a Servlet. Now, since this Servlet is…
pratnala
  • 3,723
  • 7
  • 35
  • 58
5
votes
1 answer

Tomcat thread waiting on and locking the same resource

Consider the following Java\Tomcat thread dump: "http-0.0.0.0-4080-4" daemon prio=10 tid=0x0000000019a2b000 nid=0x360e in Object.wait() [0x0000000040b71000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
4
votes
1 answer

MySQL locking when using join

I have question about mysql/innodb locking when selecting "FOR UPDATE" in a 2 table join query. Example: 2 tables - items, queue. queue.id is 1:1 connection to items.id (FOREIGN KEY). queue.status is enum with index. queue has very little number of…
NickSoft
  • 3,215
  • 5
  • 27
  • 48
4
votes
4 answers

Should I synchronize listener notifications, or not?

I am always very hesitant to bring my locks in the open, to make them public. I always try to keep the locks restricted to my implementation. Not doing that, is a recipe for deadlocks, I believe. I have the following class: class SomeClass { …
Japer D.
  • 754
  • 1
  • 9
  • 18
4
votes
5 answers

Pausing two Python threads while a third one does stuff (with locks?)

I'm new to concurrent programming. I'd like to execute three tasks repeatedly. The first two should run all the time, the third should run every hour or so. The first two tasks can run in parallel, but I always want to pause them while the third…
ke.
  • 115
  • 2
  • 8
4
votes
1 answer

Is it possible to use Java intrinsic locks explicitly?

In Java, suppose you have an array: Object[] objs = {o1, o2, ... , oN}; And a critical section: { critical(); } And you wish to execute the critical section while holding the intrinsic lock of every element in objs. I can think of one way to do…
ljp
  • 135
  • 6
4
votes
1 answer

Postgres lock behaves inconsistently over different goroutines

I've encountered some inconsistent behaviour with pg_locks on go routines and PostgreSQL 9.5. When I create additional goroutines and call SELECT pg_try_advisory_lock(1); the results are inconsistent. I can try to get the lock at some moment, fail,…
Alechko
  • 1,406
  • 1
  • 13
  • 27
4
votes
3 answers

comparing databases and their locks

I have heavy transaction stuff going on and would like to gain information about how locks are implemented in current databases. Working on zero budget my choise is limited to mysql 5.5 and postgres 9.0. Is there any site where the locks are…
hans.g
  • 149
  • 3
  • 7
4
votes
1 answer

Oracle ORA-00054 but probably no locks

I have a legacy code that is doing the following: ALTER TABLE A RENAME TO B; ALTER TABLE C RENAME TO A; ALTER TABLE B RENAME TO C; It is swapping 2 tables A and C. The problem: the third alter table DDL throws the error: ORA-00054 RESOURCE BUSY I…
Alex
  • 41
  • 3
4
votes
1 answer

Oracle SQL: NOLOCK in join statment

I can not use NOLOCK after table names in join statements. Is it even a valid scenario to try to read uncommitted data over JOINs
Naren Karanam
  • 61
  • 1
  • 3
  • 10
4
votes
0 answers

Why Segment dropped in Java 8 Concurrent Hashmap?

I was going thru the ConcurrentHashMap code in Java 8 and I see that Segment and locks are not used any more. Which means CHM does not use Locks anymore and they are replaced with intrinsic locks? Also, why not implement Tree structure for…
Raj Vee
  • 41
  • 1
1 2
3
28 29