Re: Lock.lock("info")..
David Holmes via Concurrency-interest <[email protected]> Mon, 22 Nov 2021 16:29:24 +1000
| Newsgroups | gmane.comp.java.jsr.166-concurrency |
|---|---|
| Message-ID | <[email protected]> |
This is a multipart message in MIME format. --===============5001844769939177424== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0146_01D7DFBE.23149250" Content-Language: en-au This is a multipart message in MIME format. ------=_NextPart_000_0146_01D7DFBE.23149250 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Why do you need a Holder object for the lock and condition? The lock and = condition belong in the object whose state they are guarding and = interacting with. If you are using external synchronization you wont = have an encapsulated lock/condition but the code using the = lock/condition has to know what it is actually dealing with and so that = code can report that information. =20 David =20 From: Kedar C. Raybagkar <[email protected]>=20 Sent: Monday, 22 November 2021 4:23 PM To: [email protected] Cc: [email protected] Subject: Re: [concurrency-interest] Lock.lock("info").. =20 Thank you, David. =20 That is what I have been doing but instead of having to encapsulate into = a separate holder object I thought it might be a good idea to have some = API directly available. As encapsulation also results in having a Value = Object with hashcode and equals being overridden and then keeping them = in a map with thread ids. This is already within the lock; just an = additional string or object parameter may help solve the problem. =20 Regards, -Kedar. =20 On Mon, 22 Nov 2021 at 11:28, David Holmes <[email protected] = <mailto:[email protected]> > wrote: Hi Kedar, =20 The Lock and Condition should be encapsulated inside the object that = needs them, and that object can provide whatever additional information = the callers needs on its own methods. =20 Cheers, David =20 From: Concurrency-interest <[email protected] = <mailto:[email protected]> > On Behalf Of Kedar = C. Raybagkar via Concurrency-interest Sent: Monday, 22 November 2021 3:43 PM To: [email protected] = <mailto:[email protected]>=20 Subject: [concurrency-interest] Lock.lock("info").. =20 Hi, =20 Can we have something API where we can provide why we have acquired a = lock so that when waiting on a condition if timed out we can fetch the = info and return it to the caller? =20 Regards, -Kedar. ------=_NextPart_000_0146_01D7DFBE.23149250 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" = xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta = http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta = name=3DGenerator content=3D"Microsoft Word 15 (filtered = medium)"><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} span.EmailStyle18 {mso-style-type:personal-reply; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--></head><body lang=3DEN-AU link=3Dblue = vlink=3Dpurple style=3D'word-wrap:break-word'><div = class=3DWordSection1><p class=3DMsoNormal><span = style=3D'mso-fareast-language:EN-US'>Why do you need a Holder object for = the lock and condition? The lock and condition belong in the object = whose state they are guarding and interacting with. If you are using = external synchronization you wont have an encapsulated lock/condition = but the code using the lock/condition has to know what it is actually = dealing with and so that code can report that = information.<o:p></o:p></span></p><p class=3DMsoNormal><span = style=3D'mso-fareast-language:EN-US'><o:p> </o:p></span></p><p = class=3DMsoNormal><span = style=3D'mso-fareast-language:EN-US'>David<o:p></o:p></span></p><p = class=3DMsoNormal><span = style=3D'mso-fareast-language:EN-US'><o:p> </o:p></span></p><div = style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm = 0cm 0cm'><p class=3DMsoNormal><b><span = lang=3DEN-US>From:</span></b><span lang=3DEN-US> Kedar C. Raybagkar = <[email protected]> <br><b>Sent:</b> Monday, 22 November = 2021 4:23 PM<br><b>To:</b> [email protected]<br><b>Cc:</b> = [email protected]<br><b>Subject:</b> Re: = [concurrency-interest] = Lock.lock("info")..<o:p></o:p></span></p></div><p = class=3DMsoNormal><o:p> </o:p></p><div><div><p = class=3DMsoNormal>Thank you, David.<o:p></o:p></p></div><div><p = class=3DMsoNormal><o:p> </o:p></p></div><div><p = class=3DMsoNormal>That is what I have been doing but instead of having = to encapsulate into a separate holder object I thought it might be = a good idea to have some API directly available. As = encapsulation also results in having a Value Object with hashcode = and equals being overridden and then keeping them in a map with thread = ids. This is already within the lock; just an additional string or = object parameter may help solve = the problem.<o:p></o:p></p></div><div><p = class=3DMsoNormal><o:p> </o:p></p></div><div><p = class=3DMsoNormal>Regards,<o:p></o:p></p></div><div><p = class=3DMsoNormal>-Kedar.<o:p></o:p></p></div></div><p = class=3DMsoNormal><o:p> </o:p></p><div><div><p class=3DMsoNormal>On = Mon, 22 Nov 2021 at 11:28, David Holmes <<a = href=3D"mailto:[email protected]">[email protected]</a>>= wrote:<o:p></o:p></p></div><blockquote = style=3D'border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm = 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi = Kedar,<o:p></o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>The Lock = and Condition should be encapsulated inside the object that needs them, = and that object can provide whatever additional information the callers = needs on its own methods.<o:p></o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Cheers,<o:p>= </o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>David<o:p></= o:p></p><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p><div style=3D'border:none;border-top:solid #E1E1E1 = 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span = lang=3DEN-US>From:</span></b><span lang=3DEN-US> Concurrency-interest = <<a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a>> = <b>On Behalf Of </b>Kedar C. Raybagkar via = Concurrency-interest<br><b>Sent:</b> Monday, 22 November 2021 3:43 = PM<br><b>To:</b> <a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a><br><b>Subject:</= b> [concurrency-interest] = Lock.lock("info")..</span><o:p></o:p></p></div><p = class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi,<o:p></o:= p></p><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p></div><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Can we have = something API where we can provide why we have acquired a lock so that = when waiting on a condition if timed out we can fetch the info and = return it to the caller?<o:p></o:p></p></div><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p><= /o:p></p></div><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Regards,<o:p= ></o:p></p></div><div><p class=3DMsoNormal = style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-Kedar.<o:p>= </o:p></p></div></div></div></div></blockquote></div></div></body></html> ------=_NextPart_000_0146_01D7DFBE.23149250-- --===============5001844769939177424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Concurrency-interest mailing list [email protected] http://cs.oswego.edu/mailman/listinfo/concurrency-interest --===============5001844769939177424==--