Skip to content

BaseChannelPoolHandler - Specified cast is not valid. #3

@kosomgua

Description

@kosomgua

Channel in BaseChannelPoolHandler throwing errors when ChannelReleased or ChannelAcquired called,
cause in this code you trying to cast from IAttribute<IdleStateTimer> to IdleStateTimer type.

       public virtual void ChannelReleased(IChannel channel)
       {
           IdleStateTimer idls = (IdleStateTimer)channel.GetAttribute(IDLE_KEY);
           idls.setIdle();
       }

       public virtual void ChannelAcquired(IChannel channel)
       {
           IdleStateTimer idls = (IdleStateTimer)channel.GetAttribute(IDLE_KEY);
           idls.setActive();
       }

Should be changed to

        public virtual void ChannelReleased(IChannel channel)
        {
            IdleStateTimer idls = channel.GetAttribute(IDLE_KEY).Get();
            idls.setIdle();
        }

        public virtual void ChannelAcquired(IChannel channel)
        {
            IdleStateTimer idls = channel.GetAttribute(IDLE_KEY).Get();
            idls.setActive();
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions