Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@singhala
Copy link
Contributor

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename "onMergeFailure"+

@johnynek
Copy link
Collaborator

Can you change this (should be less code) to use the proxy pattern in #202 ?

@johnynek
Copy link
Collaborator

for instance, close was not plumbed through here.

@softprops
Copy link
Contributor

yea. that's the reason it's useful. All delegation is handled for you so you don't forget things. Like closing a network connection cleanly!

you could probably do

def onMergeFailure(rescueException: Throwable => Unit): MergeableStore[K, V] =
  new MergeableStoreProxy(store) {
    override def merge(kv: (K, V)) = self.merge(kv).onFailure(rescueException)
    override def multiMerge[K1 <: K](kvs: Map[K1, V]) =
      self.multiMerge(kvs).mapValues { _.onFailure(rescueException) }
  }

shorter and safer

@johnynek
Copy link
Collaborator

johnynek commented Jan 4, 2014

@singhala ? Any update? Can we talk you into using the pattern above?

@johnynek
Copy link
Collaborator

ping

@singhala
Copy link
Contributor Author

Sorry I lost track of this while on vacation. Yes, I'll update this diff with the new pattern later today.

johnynek added a commit that referenced this pull request Jan 13, 2014
add onFailure to EnrichedMergeableStore
@johnynek johnynek merged commit abb5d32 into twitter:develop Jan 13, 2014
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapValues is lazy. This is not being applied if any keys are not accessed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants