Pivoting an object with respect to two objects I have created a quick set up to demonstrate my question. 

The red cylinder needs to rotate around the small blue box and the bottom of the cylinder must remain in the same x,y,z, location.
The cylinder must also rotate with respect to the small grey box. The top of the cylinder needs to remain attached to the grey box. The grey box rotates around the larger grey box in the center. 



If I rotate the cylinder at the blue box with the same rotation (or even a corrected rotation) the cylinder does not remain attached to the grey box. 

I set the small grey box to rotate at 1 degree per frame. 

 

How can I keep the cylinder attached to the small grey box and the small blue box and have the cylinder rotate with the same rotational speed as the grey box?
I actually figured this problem out. I selected the cylinder. Entered into edit mode. Then selected the top vertices of the cylinder. I hit "CTRL H" and selected "Hook To New Object". This created an empty which I then parented to the floating grey box using "CTRL P". I deselected all and then selected the bottom vertices of the cylinder. I hooked these to a new object also which I parented to the blue box. This way if the blue or grey box moves the red cylinder is attached to both of them.