You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jeff Hodges (JIRA)" <ji...@apache.org> on 2010/01/13 06:31:57 UTC

[jira] Created: (CASSANDRA-693) MessagingService really doesn't need an instance method

MessagingService really doesn't need an instance method
-------------------------------------------------------

                 Key: CASSANDRA-693
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-693
             Project: Cassandra
          Issue Type: Improvement
            Reporter: Jeff Hodges
            Priority: Minor


MessagingService.instance() is only used to get the perf gain from not allocating a new object everytime we send a message or get a verb handler. There is no instance data munged during it's existence and the way even the one instance is used currently is not thread-safe. It's basically a singleton with a weirdo lock around it's creation.

It seems kind of silly to have all the mental overhead of Yet Another Not-Constructor Constructor. We could do many things instead. One idea is to just make MessagingService.instance a public property of it and be done with the whole thing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CASSANDRA-693) MessagingService really doesn't need an instance method

Posted by "Jeff Hodges (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Hodges updated CASSANDRA-693:
----------------------------------

    Attachment: messaging_service_property.patch

Here's a swing at removing the weirdo lock.

> MessagingService really doesn't need an instance method
> -------------------------------------------------------
>
>                 Key: CASSANDRA-693
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-693
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jeff Hodges
>            Priority: Minor
>         Attachments: messaging_service_property.patch
>
>
> MessagingService.instance() is only used to get the perf gain from not allocating a new object everytime we send a message or get a verb handler. There is no instance data munged during it's existence and the way even the one instance is used currently is not thread-safe. It's basically a singleton with a weirdo lock around it's creation.
> It seems kind of silly to have all the mental overhead of Yet Another Not-Constructor Constructor. We could do many things instead. One idea is to just make MessagingService.instance a public property of it and be done with the whole thing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CASSANDRA-693) MessagingService really doesn't need an instance method

Posted by "Jeff Hodges (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Hodges resolved CASSANDRA-693.
-----------------------------------

    Resolution: Duplicate

Duplicate of CASSANDRA-700

> MessagingService really doesn't need an instance method
> -------------------------------------------------------
>
>                 Key: CASSANDRA-693
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-693
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jeff Hodges
>            Priority: Minor
>         Attachments: messaging_service_property.patch
>
>
> MessagingService.instance() is only used to get the perf gain from not allocating a new object everytime we send a message or get a verb handler. There is no instance data munged during it's existence and the way even the one instance is used currently is not thread-safe. It's basically a singleton with a weirdo lock around it's creation.
> It seems kind of silly to have all the mental overhead of Yet Another Not-Constructor Constructor. We could do many things instead. One idea is to just make MessagingService.instance a public property of it and be done with the whole thing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CASSANDRA-693) MessagingService really doesn't need an instance method

Posted by "Gary Dusbabek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800216#action_12800216 ] 

Gary Dusbabek commented on CASSANDRA-693:
-----------------------------------------

This patch makes it so that MessageService cannot be reused after shutdown().  There is a significant amount of work that goes on in the constructor that was executed by instance() if shutdown() had been called previously.

One approach would be to replace shutdown() with a reset() that does what shutdown() does now but takes the additional step of re-initializing things (the work done in the constructor).  Kind of lame, but it would make the code functionally similar to the way it was before the patch.

But then again, it might be wasted work since other services limit how reentrant cassandra can be overall.  Perhaps a better approach would be to state unequivocally that the cassandra services *are not* reentrant and make sure that Bad Things happen if MessagingService is used after it's shutdown() has been called.

> MessagingService really doesn't need an instance method
> -------------------------------------------------------
>
>                 Key: CASSANDRA-693
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-693
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jeff Hodges
>            Priority: Minor
>         Attachments: messaging_service_property.patch
>
>
> MessagingService.instance() is only used to get the perf gain from not allocating a new object everytime we send a message or get a verb handler. There is no instance data munged during it's existence and the way even the one instance is used currently is not thread-safe. It's basically a singleton with a weirdo lock around it's creation.
> It seems kind of silly to have all the mental overhead of Yet Another Not-Constructor Constructor. We could do many things instead. One idea is to just make MessagingService.instance a public property of it and be done with the whole thing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.